Commit d904eb10 authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: Fix Open to detect lack of schema only by ":" instead of by "://"

An URI schema is required to have ":" after it, but - even if frequently
used in practice - not //. We will soon introduce "demo:" URI scheme
that comes without //, so fix Open to detect schema presence just by ":"
and not to fixup "demo:..." url to "file://demo:..." automatically.
parent 003c44cb
...@@ -100,7 +100,7 @@ func RegisterDriver(scheme string, opener DriverOpener) { ...@@ -100,7 +100,7 @@ func RegisterDriver(scheme string, opener DriverOpener) {
// Storage authors should register their storages with RegisterStorage. // Storage authors should register their storages with RegisterStorage.
func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error) { func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error) {
// no scheme -> file:// // no scheme -> file://
if !strings.Contains(zurl, "://") { if !strings.Contains(zurl, ":") {
zurl = "file://" + zurl zurl = "file://" + zurl
} }
...@@ -115,7 +115,7 @@ func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error) ...@@ -115,7 +115,7 @@ func Open(ctx context.Context, zurl string, opt *OpenOptions) (IStorage, error)
opener, ok := driverRegistry[u.Scheme] opener, ok := driverRegistry[u.Scheme]
if !ok { if !ok {
return nil, fmt.Errorf("zodb: URL scheme \"%s://\" not supported", u.Scheme) return nil, fmt.Errorf("zodb: URL scheme \"%s:\" not supported", u.Scheme)
} }
drvWatchq := make(chan Event) drvWatchq := make(chan Event)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment