Bug 1155154 - Part 1 - Fix the check for duplicate filters when one filter is a subtring of another one. r=smaug
This commit is contained in:
@@ -7291,7 +7291,14 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker)
|
||||
if (i == j) {
|
||||
continue;
|
||||
}
|
||||
if (FindInReadable(filterToCheck.mFilter, filtersCopy[j].mFilter)) {
|
||||
// Check if this filter's extension list is a substring of the other one.
|
||||
// e.g. if filters are "*.jpeg" and "*.jpeg; *.jpg" the first one should
|
||||
// be removed.
|
||||
// Add an extra "; " to be sure the check will work and avoid cases like
|
||||
// "*.xls" being a subtring of "*.xslx" while those are two differents
|
||||
// filters and none should be removed.
|
||||
if (FindInReadable(filterToCheck.mFilter + NS_LITERAL_STRING(";"),
|
||||
filtersCopy[j].mFilter + NS_LITERAL_STRING(";"))) {
|
||||
// We already have a similar, less restrictive filter (i.e.
|
||||
// filterToCheck extensionList is just a subset of another filter
|
||||
// extension list): remove this one
|
||||
|
||||
Reference in New Issue
Block a user