1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.urllib: fix unescape

This commit is contained in:
joe-conigliaro 2019-08-02 08:31:47 +10:00 committed by Alexander Medvednikov
parent 0e798b4c51
commit 8369525d8a

View File

@ -204,7 +204,7 @@ fn unescape(s string, mode EncodingMode) ?string {
x := s[i]
switch x {
case `%`:
t.write( (unhex(s[i+1])<<byte(4) | unhex(s[i+2])).str() )
t.write( byte(unhex(s[i+1])<<byte(4) | unhex(s[i+2])).str() )
i += 2
case `+`:
if mode == .EncodeQueryComponent {
@ -482,7 +482,7 @@ fn parse_request_url(rawurl string, via_request bool) ?URL {
mut rest := p[1]
url.scheme = url.scheme.to_lower()
// if rest.ends_with('?') && strings.Count(rest, '?') == 1 {
// if rest.ends_with('?') && strings.count(rest, '?') == 1 {
if rest.ends_with('?') && !rest.trim_right('?').contains('?') {
url.force_query = true
rest = rest.left(rest.len-1)