sanitize filter_dict input

This commit is contained in:
Martijn Voncken 2008-10-04 10:20:08 +00:00
parent 6cd0ab30a5
commit ff52254924
1 changed files with 6 additions and 0 deletions

View File

@ -70,6 +70,12 @@ class FilterManager(component.Component):
if not filter_dict: if not filter_dict:
return self.torrents.get_torrent_list() return self.torrents.get_torrent_list()
#sanitize input: filter-value must be a list of strings
for key, value in filter_dict.items():
if isinstance(value, str):
filter_dict[key] = [value]
if "id"in filter_dict: #optimized filter for id: if "id"in filter_dict: #optimized filter for id:
torrent_ids = filter_dict["id"] torrent_ids = filter_dict["id"]
del filter_dict["id"] del filter_dict["id"]