BUG: PROD: v1.3.0-beta Failed image deletion dialog displays full Windows path instead of filename
Is there an existing issue for this?
- [x] I have searched the existing issues
What happened?
Description
when images fail to be deleted from the host device, the dialog message extracts filenames using:
In frontend/src/hooks/useDeleteImages.ts
${failedPaths.map((path) => path.split('/').pop()).join(', ')}
Because it only splits on the forward slash (/), on Windows systems where paths use backslashes (), split('/') does not find any separator. Consequently, .pop() returns the entire absolute Windows path rather than the file basename.
Screenshots
Steps to reproduce
- Run PictoPy v1.3.0-beta on Windows.
- Attempt to delete an image with "Delete from device" checked on a file that cannot be deleted (e.g. read-only file or permission denied).
- Observe the "Some Files Could Not Be Deleted" error dialog.
- The dialog displays the raw absolute path
(C:\Users\...\image.jpg)instead of justimage.jpg.
proposed fix (diff)
- message: `The following file(s) could not be deleted from your device: ${failedPaths.map((path) => path.split('/').pop()).join(', ')}`,
+ message: `The following file(s) could not be deleted from your device: ${failedPaths.map((path) => path.split(/[/\\]/).pop()).join(', ')}`,
Record
- [x] I agree to follow this project's Code of Conduct
👋 Thanks for opening this issue! The maintainers will review it shortly. Till then, do not open any PR. This is a strict rule we like to follow around here :)
i would like to work on this do lmk
⚠️ Potential Duplicate Issue (Semantic Match)
This issue appears semantically similar to the following issues in AOSSIE-Org/PictoPy:
-
BUG: Windows path separator breaks image filename search in AddImagesToAlbumDialog (#1528, open) https://github.com/AOSSIE-Org/PictoPy/issues/1528 Similarity: 65.2%
-
BUG: Folder setup step shows the full Windows path as the folder name, not just the basename (#1588, open) https://github.com/AOSSIE-Org/PictoPy/issues/1588 Similarity: 60.6%
Please review before proceeding.
@Prakhar1808 Can i get this assigned to me? I want to work on this
@Prakhar1808 Can i get this assigned to me? I want to work on this
hey @RitikaSen27, I am already have a working fix on this, though i would encourage you to find bugs in the latest beta
@Prakhar1808 oh okay Thanks for letting me know.