Handle paths relative to a file in urlresolve
This commit is contained in:
parent
789c0445d4
commit
c6437afc86
|
@ -30,9 +30,9 @@ def urlresolve(base):
|
|||
.scheme = $parsedbase.scheme
|
||||
| .netloc = $parsedbase.netloc
|
||||
# When the path does not start with a slash, make it relative to the base's path
|
||||
# Note that this assumes the base URL always points to a folder, even if it does not end with a /
|
||||
# by removing the filename from the base's path and appending the path
|
||||
| if .path|startswith("/")|not then (
|
||||
.path = (($parsedbase.path|rtrimstr("/")) + "/" + ($parsed.path|ltrimstr("/")))
|
||||
.path = (($parsedbase.path|split("/")[:-1]|join("/")) + "/" + ($parsed.path|ltrimstr("/")))
|
||||
) else . end
|
||||
) elif (.query // .fragment) then (
|
||||
.scheme = $parsedbase.scheme
|
||||
|
|
Loading…
Reference in New Issue