Skip to content

fix(frontend): split AddImagesToAlbumDialog's search filter on both path separators - #1587

Open
ManasBagul23 wants to merge 1 commit into
AOSSIE-Org:devfrom
ManasBagul23:fix-add-images-windows-path-search
Open

ManasBagul23 wants to merge 1 commit into
AOSSIE-Org:devfrom
ManasBagul23:fix-add-images-windows-path-search

Conversation

@ManasBagul23

@ManasBagul23 ManasBagul23 commented Oct 4, 2026 •

Copy link
Copy Markdown

Problem

The search filter in AddImagesToAlbumDialog 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" 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-label a few lines below already handles this
correctly with image.path.split(/[/\]/).pop() — used the same regex
for 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 actual
filename (sunset), and is not matched by an unrelated folder segment
(pictures) — confirmed the second case fails without the fix (the whole
path contains "pictures") and passes with it.

Summary by CodeRabbit

  • Bug Fixes
    • Image search now finds filenames in paths that use either forward or backslashes.
  • Tests
    • Added coverage for searching Windows-style paths and displaying no results for unrelated folder names.

…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
Copilot AI balanced review requested due to automatic review settings October 4, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the bug Something isn't working label Oct 4, 2026
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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
  • Configuration used: Repository: AOSSIE-Org/PictoPy/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d69e1f1-10ea-4427-8a7d-31c6d96177ac
📥 Commits

Reviewing files that changed from the base of the PR and between 8645431 and c84b142.

📒 Files selected for processing (2)
  • frontend/src/components/Albums/AddImagesToAlbumDialog.tsx
  • frontend/src/components/Albums/__tests__/AddImagesToAlbumDialog.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


Walkthrough

The album image dialog now extracts filenames using either / or \ before filtering search results. Tests cover filename searches and searches for unrelated folder segments in Windows-style paths.

Changes

Image filename search

Layer / File(s) Summary
Filename extraction and search tests
frontend/src/components/Albums/AddImagesToAlbumDialog.tsx, frontend/src/components/Albums/__tests__/AddImagesToAlbumDialog.test.tsx
The search filter splits paths on either / or \ before matching the filename. Tests check that a filename search finds a Windows-style path and that an unrelated folder-segment search shows the no-results message.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: TypeScript/JavaScript

Merge Risk: ⚪ Minimal · up to c84b1

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)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: splitting image paths on both path separators for search filtering.
Linked Issues check ✅ Passed Issue #1528 requires basename search to recognize both / and \\, find a Windows-path image by its filename, and avoid matches from parent folders. The PR summary reports that `AddImagesToAlbumDialo…
Out of Scope Changes check ✅ Passed The production change and tests directly address issue #1528. No unrelated changes are reported.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks each path with care,
Finds the filename hiding there.
Slashes turn, the search stays true,
Folder names no longer slip through.
The album waits, its list in view.

Comment @coderabbitai help to get the list of available commands.

@gitcordapp

gitcordapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

Link your account with Gitcord

Thanks for opening this PR, @ManasBagul23!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link ManasBagul23
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link ManasBagul23)

Once linked, Gitcord can notify you about reviews, merges, and more.

— Posted by Gitcord

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Windows path separator breaks image filename search in AddImagesToAlbumDialog

2 participants