Skip to content

Commit

Permalink
handle trim in the ErrNotAURL case
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmiller committed Jan 14, 2025
1 parent e0f8a34 commit 9be4eaa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion parseutil/parsepath.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ func parsePath(path string, mustParse bool, passedOptions []option) (string, err
trimmedPath := strings.TrimSpace(path)
parsed, err := url.Parse(trimmedPath)
if err != nil {
return trimmedPath, fmt.Errorf("error parsing url (%q): %w", err.Error(), ErrNotAUrl)
err = fmt.Errorf("error parsing url (%q): %w", err.Error(), ErrNotAUrl)
if opts.noTrimSpaces {
return path, err
}
return trimmedPath, err
}
switch parsed.Scheme {
case "file":
Expand Down

0 comments on commit 9be4eaa

Please sign in to comment.