Admidio / admidio

Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it’s possible to reflect the structure and permissions of your organization.
https://www.admidio.org
GNU General Public License v2.0
336 stars 131 forks source link

Upload not possible if filename contains umlauts #534

Closed Fasse closed 5 years ago

Fasse commented 7 years ago

This was possible in prior versions.

äüöß -> you got the following error

Häuser.pdf - Der ausgewählte Dateiname enthält ungültige Zeichen. Erlaubt sind nur Buchstaben und Umlaute, Zahlen 0-9 und die Sonderzeichen $!?._+-()& .

Fasse commented 7 years ago

@ximex can you look at this. Think this is a regression of some conversions.

ximex commented 7 years ago

@Fasse found the problem Commit: https://github.com/Admidio/admidio/commit/8e8c8d1664636b229e219c0e959d97fa5c667708 It's the basename function that doesn't support special chars. The strange thing is: if i run a test-script like $ php test.php it works. Maybe this is a solution: https://secure.php.net/manual/de/function.basename.php#85369

Fasse commented 7 years ago

@ximex can you have a look at this. For test reasons I remove the basename completely but I still geht the umlauts error. Maybe there is something wrong with the regex.

ximex commented 7 years ago

@Fasse I couldn't reproduce it. What PHP Version? Do you have the mb string extension installed? Couldn't you add some Logging so you could find the exact position of the error?

Fasse commented 7 years ago

you can reproduce this on the playground (PHP 5.5).

There I have removed the basename within the string.php and want to upload a häuser.txt. I still get the error.

Fasse commented 7 years ago

@Ximex can You Look at it. Otherwise I will restore the old behavior.

ximex commented 7 years ago

@Fasse i tested it in the playground and it works... look at the uploaded häuser.txt file. maybe its a browser problem? I tested with Firefox and Chrome

Fasse commented 7 years ago

Interesting, it's a browser problem.

Firefox 51 and maybe prior version on Mac wont work. Safari work. Chrome on Mac wont work.

:(

ximex commented 7 years ago

https://github.com/contao/core/issues/5501 other have this problem too.

Could you add a logging here: https://github.com/Admidio/admidio/blob/3cd9e560ecc24a0b5ea2f0949e4b963f2ef22459/adm_program/system/string.php#L249 Logging of $filename is enough. Please share the result. maybe i find a solution

Fasse commented 7 years ago

hmm, the name in the logfile is exact the correct one with umlauts.

Very strange.

JMS-S commented 6 years ago

Some FTP-programs and browsers has this problem unless using binary transfer. I have a FTP-program that won't let me upload files with any of the Danish national characters (æøå) My opinion : Filenames should be without special characters - you beg for trouble. Just for information.

Fasse commented 5 years ago

@JMS-S But Unix and Windows allow all national characters within the filename, so we should also allow them.