Skip to content

Commit 3a19bcf

Browse files
Update as per comments
1 parent 6cfc025 commit 3a19bcf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

storage/repository/parse.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ func ParseURI(s string) (fyne.URI, error) {
5959
// we should punt this to whoever generated the URI in the
6060
// first place?
6161

62-
if len(s) > 5 {
63-
path := s[5:] // everything after file:
64-
if len(path) > 2 && path[:2] == "//" {
65-
path = path[2:]
66-
}
67-
68-
// Windows files can break authority checks, so just return the parsed file URI
69-
return NewFileURI(path), nil
62+
if len(s) < 6 {
63+
return nil, errors.New("not a valid URI")
7064
}
71-
return nil, errors.New("not a valid URI")
65+
path := s[5:] // everything after file:
66+
if len(path) > 2 && path[:2] == "//" {
67+
path = path[2:]
68+
}
69+
70+
// Windows files can break authority checks, so just return the parsed file URI
71+
return NewFileURI(path), nil
7272
}
7373

7474
repo, err := ForScheme(scheme)

0 commit comments

Comments
 (0)