1
0
Fork 0
mirror of https://github.com/laravel-ls/uri synced 2026-06-16 01:54:57 +02:00

uri: change URI.Filename to just returns the filename

This commit is contained in:
Koichi Shiraishi 2019-06-11 19:45:48 +09:00
parent 7580533e42
commit 43c82a6371
No known key found for this signature in database
GPG key ID: A71DFD3B4DA7A79B

10
uri.go
View file

@ -45,15 +45,15 @@ const (
// urn:example:animal:ferret:nose
type URI string
// Filename returns the file path for the given URI. It will return an error if
// the URI is invalid, or if the URI does not have the file scheme.
func (u URI) Filename() (string, error) {
// Filename returns the file path for the given URI.
// It is an error to call this on a URI that is not a valid filename.
func (u URI) Filename() string {
filename, err := filename(u)
if err != nil {
return "", err
panic(err)
}
return filepath.FromSlash(filename), nil
return filepath.FromSlash(filename)
}
func filename(uri URI) (string, error) {