diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-20 01:23:50 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-20 01:23:50 +0200 |
commit | a8f218df98677bdc76c15d2a025b932094b08629 (patch) | |
tree | ddfb1d43bd04a0fcabec06d37c1fce36384b37c4 /src/html | |
parent | c2aa85449f7540037cf67a8725053325ab7a3912 (diff) | |
download | chawan-a8f218df98677bdc76c15d2a025b932094b08629.tar.gz |
Do not allow text() twice, etc...
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/dom.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 3bf67b05..0445aa83 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2403,8 +2403,10 @@ proc fetchClassicScript(element: HTMLScriptElement, url: URL, #TODO use charset from content-type #TODO text() should decode return r.get.text() - ).then(proc(s: string) = - let ss = newStringStream(s) #TODO unnecessary copy + ).then(proc(s: JSResult[string]) = + if s.isErr: + return + let ss = newStringStream(s.get) #TODO unnecessary copy let cs = if cs == CHARSET_UNKNOWN: CHARSET_UTF_8 else: cs let source = newDecoderStream(ss, cs = cs).readAll() #TODO use response url |