mirror of
https://github.com/laravel-ls/uri
synced 2026-07-04 08:23:43 +02:00
Change variable in New() to a more meaningful name.
This commit is contained in:
parent
6d2150a426
commit
bd941efb04
1 changed files with 10 additions and 10 deletions
20
uri.go
20
uri.go
|
|
@ -79,17 +79,17 @@ func filename(uri URI) (string, error) {
|
||||||
return u.Path, nil
|
return u.Path, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// New parses and creates a new URI from s.
|
// New parses and creates a new URI from input.
|
||||||
func New(s string) URI {
|
func New(input string) URI {
|
||||||
if u, err := url.PathUnescape(s); err == nil {
|
if u, err := url.PathUnescape(input); err == nil {
|
||||||
s = u
|
input = u
|
||||||
}
|
}
|
||||||
|
|
||||||
if IsFileURI(s) {
|
if IsFileURI(input) {
|
||||||
return URI(s)
|
return URI(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(s)
|
return File(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
// File parses and creates a new filesystem URI from path.
|
// File parses and creates a new filesystem URI from path.
|
||||||
|
|
@ -118,9 +118,9 @@ func File(path string) URI {
|
||||||
return URI(u.String())
|
return URI(u.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse parses and creates a new URI from s.
|
// Parse parses and creates a new URI from input.
|
||||||
func Parse(s string) (u URI, err error) {
|
func Parse(input string) (u URI, err error) {
|
||||||
us, err := url.Parse(s)
|
us, err := url.Parse(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return u, fmt.Errorf("url.Parse: %w", err)
|
return u, fmt.Errorf("url.Parse: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue