mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net.http: use .filter in sanitize/2 (#8899)
This commit is contained in:
parent
1658c4789f
commit
b2cdd2cac0
@ -277,15 +277,7 @@ fn sanitize(valid fn(byte) bool, v string) string {
|
||||
if ok {
|
||||
return v.clone()
|
||||
}
|
||||
// TODO: Use `filter` instead of this nonesense
|
||||
buf := v.bytes()
|
||||
mut bytes := v.bytes()
|
||||
for i, _ in buf {
|
||||
if !valid(buf[i]) {
|
||||
bytes.delete(i)
|
||||
}
|
||||
}
|
||||
return bytes.bytestr()
|
||||
return v.bytes().filter(valid(it)).bytestr()
|
||||
}
|
||||
|
||||
fn sanitize_cookie_name(name string) string {
|
||||
|
Loading…
Reference in New Issue
Block a user