about summary refs log tree commit diff stats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-27 22:01:03 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-27 22:16:16 +0100
commit4df668fd2225278d4745a67613efd9859bc8c1a0 (patch)
tree4e689276743ee1deddd8175e1eb09159c6fb0115 /src/types
parentfddc8d8da34b2f05b99d56b3c753a7b00d54ae7c (diff)
downloadchawan-4df668fd2225278d4745a67613efd9859bc8c1a0.tar.gz
Rework broken non-blocking io
Piped input works correctly again!
(Also fix hash's setter not working with url's without a fragment)
Diffstat (limited to 'src/types')
-rw-r--r--src/types/url.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/types/url.nim b/src/types/url.nim
index fc9e20e8..f77faec1 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -702,6 +702,7 @@ proc basicParseUrl*(input: string, base = none(Url), url: Url = Url(), stateOver
       #TODO encoding
       if not has or (not override and c == '#'):
         let querypercentencodeset = if url.is_special: SpecialQueryPercentEncodeSet else: QueryPercentEncodeSet
+        if url.query.isNone: url.query = some("")
         url.query.get.percentEncode(buffer, querypercentencodeset)
         buffer = ""
         if has and c == '#':
@@ -715,6 +716,7 @@ proc basicParseUrl*(input: string, base = none(Url), url: Url = Url(), stateOver
       if has:
         #TODO If c is not a URL code point and not U+0025 (%), validation error.
         #TODO If c is U+0025 (%) and remaining does not start with two ASCII hex digits, validation error.
+        if url.fragment.isNone: url.fragment = some("")
         url.fragment.get.percentEncode(c, FragmentPercentEncodeSet)
     inc pointer
   return url.some
@@ -950,7 +952,7 @@ proc set*(params: URLSearchParams, name: string, value: string) {.jsfunc.} =
 proc newURL*(url: URL): URL =
   new(result)
   result[] = url[]
-  if url.searchParams != nil: #TODO ideally this should never be false
+  if url.searchParams != nil: #TODO ideally this would never be false
     result.searchParams = URLSearchParams()
     result.searchParams[] = url.searchParams[]
     result.searchParams.url = some(result)