Skip to content

Fix uniqueName hanging on extensionless file names - #1

Merged
Xeross99 merged 1 commit into
Xeross99:mainfrom
OpenDeernet:fix/unique-name-extensionless
Nov 9, 2026
Merged

Xeross99 merged 1 commit into
Xeross99:mainfrom
OpenDeernet:fix/unique-name-extensionless

Conversation

@OpenDeernet

Copy link
Copy Markdown
Contributor

Problem

uniqueName builds a free name by inserting -N before the file extension. When the name has no extension, that replace leaves the candidate unchanged, so a collision (for example saving two JPEGs both named export into the same folder or ZIP) loops forever and the save never finishes.

droppedPhotos already accepts files with an empty MIME type and no extension (macOS Photos / HEIC in Chrome), and the change-date tool keeps a JPEG's original name via redatedFileName, so the hang is reachable.

Fix

If the name has an extension, keep inserting -N before it. Otherwise append -N to the whole name.

Test

Added a unit case for an extensionless collision (export / export-2 → export-3). Before the fix that case never returned; after it, all 143 unit tests pass (npm test).

When a dropped photo has no extension (macOS Photos sometimes drops one)
and that name is already taken, the old replace left the candidate unchanged
and the save loop never finished. Append -N when there is no extension.
@Xeross99
Xeross99 merged commit d336179 into Xeross99:main Nov 9, 2026
@Xeross99

Xeross99 commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Nice catch, thanks! Merged 😁

@OpenDeernet

Copy link
Copy Markdown
Contributor Author

Thanks for merging — glad it was useful!

This branch was successfully deployed

1 active deployment
github-pages — d3361791 Deployed Nov 9, 2026 by Xeross99 via deploy #42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants