aboutsummaryrefslogtreecommitdiff
path: root/internal/sqlutil/uri.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/sqlutil/uri.go')
-rw-r--r--internal/sqlutil/uri.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/sqlutil/uri.go b/internal/sqlutil/uri.go
index 703258e6..e2c825d9 100644
--- a/internal/sqlutil/uri.go
+++ b/internal/sqlutil/uri.go
@@ -15,14 +15,20 @@
package sqlutil
import (
+ "errors"
"fmt"
"net/url"
+
+ "github.com/matrix-org/dendrite/internal/config"
)
// ParseFileURI returns the filepath in the given file: URI. Specifically, this will handle
// both relative (file:foo.db) and absolute (file:///path/to/foo) paths.
-func ParseFileURI(dataSourceName string) (string, error) {
- uri, err := url.Parse(dataSourceName)
+func ParseFileURI(dataSourceName config.DataSource) (string, error) {
+ if !dataSourceName.IsSQLite() {
+ return "", errors.New("ParseFileURI expects SQLite connection string")
+ }
+ uri, err := url.Parse(string(dataSourceName))
if err != nil {
return "", err
}