This commit is contained in:
flywind
2021-03-30 02:48:06 +08:00
committed by GitHub
parent 861c42c258
commit 1f1ef85eb0
2 changed files with 12 additions and 1 deletions

View File

@@ -294,7 +294,7 @@ func parseUri*(uri: string, result: var Uri) =
var i = 0
# Check if this is a reference URI (relative URI)
let doubleSlash = uri.len > 1 and uri[1] == '/'
let doubleSlash = uri.len > 1 and uri[0] == '/' and uri[1] == '/'
if i < uri.len and uri[i] == '/':
# Make sure `uri` doesn't begin with '//'.
if not doubleSlash:

View File

@@ -283,5 +283,16 @@ template main() =
doAssert toSeq(decodeQuery("a=1&b=0")) == @[("a", "1"), ("b", "0")]
doAssert toSeq(decodeQuery("a=1&b=2c=6")) == @[("a", "1"), ("b", "2c=6")]
block: # bug #17481
let u1 = parseUri("./")
let u2 = parseUri("./path")
let u3 = parseUri("a/path")
doAssert u1.scheme.len == 0
doAssert u1.path == "./"
doAssert u2.scheme.len == 0
doAssert u2.path == "./path"
doAssert u3.scheme.len == 0
doAssert u3.path == "a/path"
static: main()
main()