Skip to content
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

Replace OriginalFileName + Extension with path.Base() #217

Closed
wants to merge 0 commits into from

Conversation

matthewkeller36
Copy link
Contributor

Packs the filename to include both name and extension. Removes issues with duplicate extensions being listed when a.OriginalFileName already contains the extension.

Example file: IMG_1011.JPG

Original: Name = IMG_1011.JPG.JPG
New: Name = IMG_1011.JPG

This was causing issues with --ignore-extension only removing one extension when comparing names rather than both.

@simulot
Copy link
Owner

simulot commented Apr 3, 2024

I remember some issues around this.
We may have file names with dots liker '2023.04.23.original.jpg' and '2023.04.23.modified.jpg' which aren't real duplicates too.

@matthewkeller36
Copy link
Contributor Author

From my understanding, path.Base should still return the full filename with extension (2023.04.23.original.jpg), correct? Then, if we are using the -ignore-extension tag, we could remove the extension from the Name field using TrimSuffix. This would not cause issues with files containing multiple dots since only the extension suffix is trimmed, not the rest of the name.

@simulot
Copy link
Owner

simulot commented Apr 3, 2024

Trimming the result of path.Ext() isn't safe:
https://go.dev/play/p/QnxJjl8x3iu

Maybe only trim extension recognized by the server... several time to check cases like image.cr3.jpg

@matthewkeller36
Copy link
Contributor Author

matthewkeller36 commented Apr 4, 2024

I do not see the issue being shown in that example. It is outputting the full extension which the code should be doing correctly. The only case I can see using path.Base and then TrimSuffix would cause an issue would be for files whose name is only the extension (.jpg, .png, etc.) but this would be horrible naming convention to use already.
https://go.dev/play/p/VJJBa8YRRqK

@simulot
Copy link
Owner

simulot commented Apr 12, 2024

I'm working on the TUI for the duplicate command...
image

The are plenty of changes for TUI
I'll fix that

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