mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #14314] [MERGED] fix: Correctly handle toggle filters to prevent unintended activation #10238
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/14314
Author: @fl0w1nd
Created: 5/25/2025
Status: ✅ Merged
Merged: 5/26/2025
Merged by: @tjbck
Base:
dev← Head:dev📝 Commits (1)
332043cfix: Correctly handle toggle filters to prevent unintended activation📊 Changes
1 file changed (+9 additions, -7 deletions)
View changed files
📝
backend/open_webui/utils/filter.py(+9 -7)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
get_sorted_filter_idswhere toggleable filters that were not explicitly enabled could still be considered active if multiple such filters existed. The issue was caused by modifying theactive_filter_idslist while iterating over it, leading to some filters being skipped in the evaluation process. The fix refactors this logic to use a list comprehension, ensuring accurate filtering of active toggleable filters.Added
Changed
get_sorted_filter_idsforactive_filter_ids. It now uses a list comprehension with a helper functionshould_keep_filterto determine if a toggleable filter should remain active, rather than removing items from the list during iteration.Nonecheck forenabled_filter_ids(usingenabled_filter_ids or []) within theshould_keep_filterlogic to prevent potential errors.Deprecated
Removed
Fixed
enabled_filter_ids. This occurred due to modifying a list while iterating over it, causing some elements to be skipped.Security
Breaking Changes
Additional Information
Discussion
Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.