aboutsummaryrefslogtreecommitdiff
path: root/syncapi
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-04 11:18:08 +0100
committerGitHub <noreply@github.com>2020-06-04 11:18:08 +0100
commite7d1ac84c32a10f8deb7bcfc94531386312179c7 (patch)
treecfb8176ebcd9cd1087aa1c34f6f362dd2851dcdc /syncapi
parentd4f9a4bb97c0c66963d7fd9c1395614a2198112e (diff)
Add ParseFileURI and use it when dealing with file URIs (#1088)
* Add ParseFileURI and use it when dealing with file URIs Fixes #1059 * Missing file * Linting
Diffstat (limited to 'syncapi')
-rw-r--r--syncapi/storage/sqlite3/syncserver.go12
1 files changed, 1 insertions, 11 deletions
diff --git a/syncapi/storage/sqlite3/syncserver.go b/syncapi/storage/sqlite3/syncserver.go
index 5ba07617..38ce5bcf 100644
--- a/syncapi/storage/sqlite3/syncserver.go
+++ b/syncapi/storage/sqlite3/syncserver.go
@@ -17,8 +17,6 @@ package sqlite3
import (
"database/sql"
- "errors"
- "net/url"
"github.com/matrix-org/dendrite/internal/sqlutil"
@@ -43,18 +41,10 @@ type SyncServerDatasource struct {
// nolint: gocyclo
func NewDatabase(dataSourceName string) (*SyncServerDatasource, error) {
var d SyncServerDatasource
- uri, err := url.Parse(dataSourceName)
+ cs, err := sqlutil.ParseFileURI(dataSourceName)
if err != nil {
return nil, err
}
- var cs string
- if uri.Opaque != "" { // file:filename.db
- cs = uri.Opaque
- } else if uri.Path != "" { // file:///path/to/filename.db
- cs = uri.Path
- } else {
- return nil, errors.New("no filename or path in connect string")
- }
if d.db, err = sqlutil.Open(internal.SQLiteDriverName(), cs, nil); err != nil {
return nil, err
}