Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmd/bd/doctor_health.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ func runCheckHealth(path string) {
}

// Open database once for all checks (single DB connection)
db, err := sql.Open("sqlite3", "file:"+dbPath+"?mode=ro")
// Escape '#' in the path to prevent URI fragment truncation (GH#2115).
// In SQLite URI format, '#' starts a fragment that is silently discarded.
escapedPath := strings.ReplaceAll(dbPath, "#", "%23")
db, err := sql.Open("sqlite3", "file:"+escapedPath+"?mode=ro")
if err != nil {
// Can't open DB - only check hooks
if issue := doctor.CheckHooksQuick(Version); issue != "" {
Expand Down
4 changes: 3 additions & 1 deletion cmd/bd/migrate_dolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ func hooksNeedDoltUpdate(beadsDir string) bool {
// This is the CGO path — it reads SQLite directly via the ncruces/go-sqlite3 driver.
// For non-CGO builds, see migrate_shim.go which uses the sqlite3 CLI instead.
func extractFromSQLite(ctx context.Context, dbPath string) (*migrationData, error) {
db, err := sql.Open("sqlite3", "file:"+dbPath+"?mode=ro")
// Escape '#' in the path to prevent URI fragment truncation (GH#2115).
escapedPath := strings.ReplaceAll(dbPath, "#", "%23")
db, err := sql.Open("sqlite3", "file:"+escapedPath+"?mode=ro")
if err != nil {
return nil, fmt.Errorf("failed to open SQLite database: %w", err)
}
Expand Down