mirror of
https://github.com/laravel-ls/uri
synced 2026-06-16 01:54:57 +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
|
||||
}
|
||||
|
||||
// New parses and creates a new URI from s.
|
||||
func New(s string) URI {
|
||||
if u, err := url.PathUnescape(s); err == nil {
|
||||
s = u
|
||||
// New parses and creates a new URI from input.
|
||||
func New(input string) URI {
|
||||
if u, err := url.PathUnescape(input); err == nil {
|
||||
input = u
|
||||
}
|
||||
|
||||
if IsFileURI(s) {
|
||||
return URI(s)
|
||||
if IsFileURI(input) {
|
||||
return URI(input)
|
||||
}
|
||||
|
||||
return File(s)
|
||||
return File(input)
|
||||
}
|
||||
|
||||
// File parses and creates a new filesystem URI from path.
|
||||
|
|
@ -118,9 +118,9 @@ func File(path string) URI {
|
|||
return URI(u.String())
|
||||
}
|
||||
|
||||
// Parse parses and creates a new URI from s.
|
||||
func Parse(s string) (u URI, err error) {
|
||||
us, err := url.Parse(s)
|
||||
// Parse parses and creates a new URI from input.
|
||||
func Parse(input string) (u URI, err error) {
|
||||
us, err := url.Parse(input)
|
||||
if err != nil {
|
||||
return u, fmt.Errorf("url.Parse: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue