From 29543dae95320130ed00bf602d74f22cfa12d77f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 24 Feb 2020 11:40:00 +1100 Subject: [PATCH] Include file: and escape paths passed through to sqlite3 Fixes #240. --- pkg/persistence/sqlite3.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/persistence/sqlite3.go b/pkg/persistence/sqlite3.go index f7485e9..7f83c0b 100644 --- a/pkg/persistence/sqlite3.go +++ b/pkg/persistence/sqlite3.go @@ -31,7 +31,11 @@ func makeSqlite3Database(url_ *url.URL) (Database, error) { } var err error - url_.Scheme = "" + // To handle spaces in the file path, we ensure that URI path handling is triggered in the + // sqlite3 driver, and that escaping is applied to the URL on this side. See issue #240. + url_.Scheme = "file" + // To ensure that // isn't injected into the URI. The query is still handled. + url_.Opaque=url_.Path db.conn, err = sql.Open("sqlite3", url_.String()) if err != nil { return nil, errors.Wrap(err, "sql.Open")