diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-09-28 23:04:17 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-09-28 23:04:17 +0100 |
commit | d8a10457e21654272e9de67048182d845e87eb3a (patch) | |
tree | a9b640f2d3353595ba923a09e52e4ea17124f0e4 /lib/pure/uri.nim | |
parent | bb7604c06fb2adc6999d47fdfcbf9cf2979bef9e (diff) | |
download | Nim-d8a10457e21654272e9de67048182d845e87eb3a.tar.gz |
Fixes #3207.
Diffstat (limited to 'lib/pure/uri.nim')
-rw-r--r-- | lib/pure/uri.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pure/uri.nim b/lib/pure/uri.nim index 492de3b46..abb1a462d 100644 --- a/lib/pure/uri.nim +++ b/lib/pure/uri.nim @@ -142,6 +142,7 @@ proc parseUri*(uri: string): Uri = parseUri(uri, result) proc removeDotSegments(path: string): string = + if path.len == 0: return "" var collection: seq[string] = @[] let endsWithSlash = path[path.len-1] == '/' var i = 0 @@ -432,3 +433,12 @@ when isMainModule: block: let test = parseUri("http://example.com/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" |