Skip to content

Commit

Permalink
fix(BRIDGE-10): escaping db path when creating connection
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroNafta committed Apr 22, 2024
1 parent 3734c76 commit d9958ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/db_impl/sqlite3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io/fs"
"net/url"
"os"
"path/filepath"
"sync"
Expand Down Expand Up @@ -287,7 +288,9 @@ func pathExists(path string) (bool, error) {
}

func getDatabaseConn(dir, userID, path string) string {
return fmt.Sprintf("file:%v?cache=shared&_fk=1&_journal=WAL", path)
// We need to escape special characters in the db path, such as #
escapedPath := url.PathEscape(path)
return fmt.Sprintf("file:%v?cache=shared&_fk=1&_journal=WAL", escapedPath)
}

func TestUpdateDBVersion(ctx context.Context, dbPath, userID string, version int) error {
Expand Down

0 comments on commit d9958ee

Please sign in to comment.