fix(frontend): split AddImagesToAlbumDialog's search filter on both path separators - #1587
ManasBagul23 wants to merge 1 commit into
Conversation
…ath separators
The search filter extracted the filename with image.path.split('/').pop(),
only splitting on the forward slash. On Windows, where paths use
backslashes, this left the whole absolute path as the 'filename', so
searching by the actual filename could miss the image while an
unrelated folder segment in the path would wrongly match.
The image grid's own aria-label a few lines down already handles this
correctly with image.path.split(/[/\]/).pop() -- used the same
regex here for the search filter.
Fixes AOSSIE-Org#1528
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. WalkthroughThe album image dialog now extracts filenames using either ChangesImage filename search
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix · Severity of issue fixed: Low Suggested labels: Merge Risk: ⚪ Minimal · up to Windows-style paths now search by filename without matching parent folders; no actionable merge risk is established. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks each path with care, Comment |
Link your account with GitcordThanks for opening this PR, @ManasBagul23! To receive Discord notifications and contributor tracking for this organization:
Once linked, Gitcord can notify you about reviews, merges, and more. — Posted by Gitcord |
Problem
The search filter in
AddImagesToAlbumDialogextracted the filename withimage.path.split('/').pop(), only splitting on the forward slash. OnWindows, where paths use backslashes, this left the whole absolute path as
the "filename" the search compares against — searching by the actual
filename could miss the image, while an unrelated folder segment anywhere
in the path would wrongly match instead.
Fixes #1528
Fix
The image grid's own
aria-labela few lines below already handles thiscorrectly with
image.path.split(/[/\]/).pop()— used the same regexfor the search filter so both agree on what the "filename" is.
Verified
Added
AddImagesToAlbumDialog.test.tsx: a Windows-style path(
C:\Users\me\Pictures\sunset.jpg) is found when searching its actualfilename (
sunset), and is not matched by an unrelated folder segment(
pictures) — confirmed the second case fails without the fix (the wholepath contains "pictures") and passes with it.
Summary by CodeRabbit