LibWeb: Identical sub-expression bug in URLSearchParams::set

Flagged by sonarcloud, we appear to want to make sure the entry.name
matches the name we are searching for duplicates of.

Link:
https://sonarcloud.io/project/issues?fileUuids=AXvdC606QRvsO1F91p5C&id=SerenityOS_serenity&open=AXvdC_NEQRvsO1F91p6j
This commit is contained in:
Brian Gianforcaro 2021-09-12 21:12:21 -07:00 committed by Brian Gianforcaro
parent fc1b9288bc
commit 7852b0fbc3
Notes: sideshowbarker 2024-07-18 04:02:18 +09:00

View file

@ -88,7 +88,7 @@ void URLSearchParams::set(const String& name, const String& value)
if (!existing.is_end()) {
existing->value = value;
m_list.remove_all_matching([&name, &existing](auto& entry) {
return &entry != &*existing && name == name;
return &entry != &*existing && entry.name == name;
});
}
// 2. Otherwise, append a new name-value pair whose name is name and value is value, to thiss list.