sircharlo / meeting-media-manager

A cross platform app to download and present media for congregation meetings of Jehovah’s Witnesses in any language. Features include automatic media downloading, easy drag-and-drop adding of additional media, and media presentation tools for meetings.
https://sircharlo.github.io/meeting-media-manager/
GNU Affero General Public License v3.0
140 stars 24 forks source link

[Bug]: unable to import files with almost the same name #3281

Open dagandrew opened 22 hours ago

dagandrew commented 22 hours ago

What happened?

Only one file was imported. Maybe it happened because the file name was more than 100 characters long and it thinks that it's the same name but in my case the name was almost the same, and only Part 1 and Part 2 was different.

To Reproduce

  1. Go to 'Import', then Media Files or drag and drop the files with almost the same name
  2. Upload
  3. See that only one of them is there

What did you expect to happen?

Both files to be saved

Version

24.11.1

What platform are you seeing the problem on?

Windows

Relevant log output

No response

Screenshots

No response

Additional context

No response

Confirmations

dagandrew commented 22 hours ago

I think that they were both uploaded but then the program thought that one of them was a duplicate and quickly deleted it

sircharlo commented 20 hours ago

This is possibly happening because extremely long filenames and paths are trimmed. The filename and path length limit is a filesystem limitation, unfortunately. Maybe what we could do is to remove a few extra characters from a path that was trimmed, and add a unique suffix. This would prevent this specific issue.


Example:

mtdvlpr commented 20 hours ago

This is possibly happening because extremely long filenames and paths are trimmed. The filename and path length limit is a filesystem limitation, unfortunately. Maybe what we could do is to remove a few extra characters from a path that was trimmed, and add a unique suffix. This would prevent this specific issue.

Example:

* Original filename: `This is a really long filename that should get trimmed automatically.jpg`

* Current trimmed result: `This is a really long filename that sh.jpg`

* Proposed trimmed result: `This is a really long filename th_0rS4.jpg`

* Original filename: `This is a really long filename that should get trimmed automatically 2.jpg`

* Current trimmed result: `This is a really long filename that sh.jpg` <- Same as first file!

* Proposed trimmed result: `This is a really long filename th_Hxo6.jpg`

@sircharlo, that's exactly what I'm currently testing locally!

sircharlo commented 20 hours ago

@sircharlo, that's exactly what I'm currently testing locally!

What's that saying about great minds? 😆

mtdvlpr commented 20 hours ago

Implemented in c04f7d3764fcede46fb5731936911f0974ba9474