Skip to content

Commit f724952

Browse files
committed
filter empty bindings from query string parsing
Ignore empty segments produced by && or trailing & in URLs. Prevents spurious ("", "") entries in conf.env.
1 parent 15d82fb commit f724952

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/util.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,9 @@ let create_env s =
12231223
Adef.encoded (String.sub s (succ i) (String.length s - succ i)) )
12241224
else separate (succ i) s
12251225
in
1226-
List.map (separate 0) (get_assoc 0 0)
1226+
List.filter_map
1227+
(fun s -> if s = "" then None else Some (separate 0 s))
1228+
(get_assoc 0 0)
12271229

12281230
let std_color conf (s : Adef.safe_string) =
12291231
"<span style=\"color:" ^<^ conf.highlight ^<^ "\">" ^<^ s ^>^ "</span>"

0 commit comments

Comments
 (0)