Fixes #3207.
This commit is contained in:
parent
bb7604c06f
commit
d8a10457e2
1 changed files with 10 additions and 0 deletions
|
|
@ -142,6 +142,7 @@ proc parseUri*(uri: string): Uri =
|
||||||
parseUri(uri, result)
|
parseUri(uri, result)
|
||||||
|
|
||||||
proc removeDotSegments(path: string): string =
|
proc removeDotSegments(path: string): string =
|
||||||
|
if path.len == 0: return ""
|
||||||
var collection: seq[string] = @[]
|
var collection: seq[string] = @[]
|
||||||
let endsWithSlash = path[path.len-1] == '/'
|
let endsWithSlash = path[path.len-1] == '/'
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
@ -432,3 +433,12 @@ when isMainModule:
|
||||||
block:
|
block:
|
||||||
let test = parseUri("http://example.com/foo/") / "/bar/asd"
|
let test = parseUri("http://example.com/foo/") / "/bar/asd"
|
||||||
doAssert test.path == "/foo/bar/asd"
|
doAssert test.path == "/foo/bar/asd"
|
||||||
|
|
||||||
|
# removeDotSegments tests
|
||||||
|
block:
|
||||||
|
# empty test
|
||||||
|
doAssert removeDotSegments("") == ""
|
||||||
|
|
||||||
|
# bug #3207
|
||||||
|
block:
|
||||||
|
doAssert parseUri("http://qq/1").combine(parseUri("https://qqq")).`$` == "https://qqq"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue