Repository navigation
refactor: update string filtering to be case-insensitive for improved search functionality #7874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the diff
1.
__contains→__icontains(lines 245, 400, 533)Good change. Case-insensitive search is usually what users expect for a name filter.
icontainsusesILIKE '%...%', which cannot use a normal btree index. If these tables can become large, consider:pg_trgmGIN index onasker.username/name, orSearchVector) if search is a first-class feature.Also note: Django's
containsalready escapes%/_, so no injection risk — just performance.2.
Content-Dispositionf-string → plain string (lines 329, 500, 630)Correct cleanup. The f-string has no placeholders, so removing it is safe and slightly faster/branch-free.
Minor suggestion: since a filename is being hardcoded repeatedly, consider extracting a constant or helper, e.g.:
This removes triplicate code and ensures future header changes (e.g. adding RFC 5987
filename*=UTF-8''...for non-ASCII names) only need to happen once.💡 The MIME type
application/vnd.ms-excelis for legacy.xls. Since you're writing.xlsxvia openpyxl, the correct type is:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"3. Added
is_resource_filter = False(line ~408)This aligns the branch with the sibling method at line ~536, where the same
workspace_managebranch already sets the flag toFalse.✅ Behavioral fix: when the user is a workspace manager, the extra "resource filter" step was previously still applied. Now it's skipped consistently. Confirm that this is intentional — before, managers were likely getting results filtered by
_apply_resource_filter(...)even though they had full access, which would silently hide records. If tests exist for manager-scoped listing, they should be updated.Summary table
icontains×3is_resource_filter = FalseNo correctness regressions spotted; the main open questions are the intent of the
is_resource_filterchange (tests?) and the MIME-type mismatch.