From a635f0ef91fc388c0a2ee4aa36462c5e45134e82 Mon Sep 17 00:00:00 2001 From: FourteenBrush <74827262+FourteenBrush@users.noreply.github.com> Date: Sat, 29 Aug 2026 22:39:15 +0200 Subject: [PATCH] `net.split_url`: fix length on query values --- core/net/url.odin | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/net/url.odin b/core/net/url.odin index d2ac709cd..9f71af79b 100644 --- a/core/net/url.odin +++ b/core/net/url.odin @@ -44,16 +44,13 @@ split_url :: proc(url: string, allocator := context.allocator) -> (scheme, host, if query_str != "" { queries = make(map[string]string, allocator) for query in strings.split_iterator(&query_str, "&") { - i = strings.index_byte(query, '=') - if i == -1 { - queries[query] = "" - } else { - value := query[i+1:] - if strings.index_byte(value, '=') != -1 { - continue // incorrect format - } - queries[query] = value // may not be set to anything, e.g. ?x= + query := query + key := strings.split_by_byte_iterator(&query, '=') or_continue + value, _ := strings.split_by_byte_iterator(&query, '=') // may be empty + if strings.index_byte(query, '=') != -1 { + continue // additional =, weird x=y=z format } + queries[key] = value } } }