numero2 / contao-proper-filenames

Replaces special characters in filenames right after upload.
https://www.numero2.de/contao/erweiterungen/proper-filenames.html
GNU Lesser General Public License v3.0
13 stars 5 forks source link

Only two uploads if doNotTrimFilenames is deactivated #14

Closed akroii closed 3 years ago

akroii commented 3 years ago

Greetings, when i uncheck the chexbox doNotTrimFilenamesonly two uploads where uploaded.

I have 13 pdf files, which i upload simultaneously. All files look like this:

NiNu_Lokales_MA_Poster_Update_2051_KV_Nordrhein_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Mecklenburg-Vorpommern_v06.pdf

The upload runs completely, but after it only remains 2 files.

Contao 4.9.22 numero2/contao-proper-filenames 2.1.4

bennyborn commented 3 years ago

If all the files have a filename that starts the same and have around the same length I can totally see why having doNotTrimFilenames unchecked could cause this. That is not a bug, rather expected behaviour 🤷‍♂️

Take a look at how the files are named after uploading.

akroii commented 3 years ago

My files are in lowercase after uploading image

bennyborn commented 3 years ago

What is the actual name of the file after uploading?

akroii commented 3 years ago

Before: NiNu_Lokales_MA_Poster_2021_KV_Berlin.pdf After: ninu_lokales_ma_poster_2021_kv_b.pdf

bennyborn commented 3 years ago

You see? If you were now to upload a file named NiNu_Lokales_MA_Poster_2021_KV_Bremen.pdf it would be truncated to the same name and therefore overwrite the old file. So in your case you should enable doNotTrimFilenames globally or at least enable Do not check/rename for the folder in the File Manager.

akroii commented 3 years ago

and why only 2 files being uploaded?

fritzmg commented 3 years ago

Post all file names, that you are trying to upload.

bennyborn commented 3 years ago

Can't tell. My best bet is that rather than there being a problem with the upload itself (which we don't intercept) it might come down to files being renamed to the same filename and therefor overwritten.

akroii commented 3 years ago
NiNu_Lokales_MA_Poster_2021_KV_Berlin.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Baden-Wuertemberg_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Brandenburg_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Hamburg_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Mecklenburg-Vorpommern_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Niedersachsen_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Nordrhein_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Rheinland-Pfalz,v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Saarland_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Sachsen_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Schleswig-Holstein_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Thueringen_v06.pdf
NiNu_Lokales_MA_Poster_Update_2051_KV_Westfalen-Lippe_v06.pdf
bennyborn commented 3 years ago

NiNu_Lokales_MA_Poster_2021_KV_Berlin.pdf becomes ninu_lokales_ma_poster_2021_kv_b.pdf and therefore all your other files will be renamed to ninu_lokales_ma_poster_update_20.pdf.

The twelve other files will all be named the same after truncating them. Thats why you'll end up with just two files.

fritzmg commented 3 years ago

@akroii if you need file names that are longer than 32 characters, then you need to disable the functionality to automatically shorten file names to 32 characters.

akroii commented 3 years ago

@fritzmg i already did.

of course, it becomes duplicates, the second one will be overwritten. this is why only two files remaining. 🤦‍♂️