View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|14091||Bug reports||Survey taking||public||2018-09-24 16:21||2021-03-11 11:38|
|Summary||14091: Filenames of uploads starting with special characters truncated|
|Description||Non-ANSI characters (e.g. umlauts (äöü) ) at the beginning of uploaded files are cut off.|
|Steps To Reproduce||When taking a survey that contains a file upload field:|
1. Choose a file with an umlaut at the beginning
2. See file with umlaut at the beginning cut off
|Additional Information||This is due to locale-awareness of PHP's basename().|
Also see https://stackoverflow.com/questions/45268499/php-basename-and-pathinfo-with-multibytes-utf-8-file-names/45268539#45268539 for other related functions with the same feature.
in index.php fixes it, but I am sure this is not the right place to add this.
My system locale (on debian) is correctly set (apart from LC_ALL, which normally is just an override and should not be set).
Please either respect system's LANG or set the locale to some UTF-8 compatible one.
|Tags||No tags attached.|
|Complete LimeSurvey version number (& build)||3.14.9+180917|
|I will donate to the project if issue is resolved||No|
|Database & DB-Version||mySQL 5.5.60|
|Server OS (if known)||debian|
|Webserver software & version (if known)||apache 2.4.10|
|yes we have hard filtering of file names for security reason.|
I understand file names get filtered, but this does not seem related. Why does setting the correct locale circumvent the filtering?
I feel like filtering should be done after correctly interpreting the code points with the correct locale.
But I may be wrong.
If only ASCII (or even a more reduced subset) is allowed, a note should advise users to rename their files (and only list allowed characters). Though this seems pretty uncommon. There should be standard functions to sanitize the string and frankly, umlauts don't seem all too dangerous :)
«yes we have hard filtering of file names for security reason. » ???
Filtering äöü have nothing with security , andis not filtered like this in 'Upload question' type.
@tbart : where it's filtered like this ? And what is the broken locale
Your filenames do not start with special characters. See screenshot attached.
The locale should be en_US.UTF-8, at least that's what the environment sets for LANG:
# set | egrep "^(LANG|LC)"
My filename was äöü.png ;) , but my locale is OK.
Can show your current locale in PHP ?
Sorry, I misread your screenshot and thought the left column were the filenames, my bad.
phpinfo() gives me:
It's still strange why only umlauts at the beginning get stripped off. This should not be locale dependent!
|Please update to the latest version and check if the bug can still be reproduced. Thank you.|
I can confirm this is still broken in Version 3.25.17+210309.
Attached is a sample survey+file. Uploading the file results in a file name "sterreich.png"
in index.php still fixes it.
limesurvey_survey_185162.lss (13,472 bytes)
|2018-09-24 16:21||tbart||New Issue|
||Assigned To||=> LouisGac|
||Status||new => closed|
||Resolution||open => no change required|
||Note Added: 50169|
|2019-01-14 17:40||tbart||Note Added: 50188|
|2019-01-15 08:40||DenisChenu||Status||closed => feedback|
|2019-01-15 08:40||DenisChenu||Resolution||no change required => reopened|
|2019-01-15 08:40||DenisChenu||Note Added: 50192|
|2019-01-15 08:40||DenisChenu||File Added: Capture d’écran du 2019-01-15 08-40-13.png|
|2019-01-15 08:51||DenisChenu||Note Edited: 50192||View Revisions|
|2019-01-15 09:06||tbart||File Added: umlauts_at_the_beginning_cut_off.png|
|2019-01-15 09:06||tbart||Note Added: 50194|
|2019-01-15 09:06||tbart||Status||feedback => assigned|
|2019-01-15 10:00||DenisChenu||Note Added: 50205|
|2019-01-15 10:37||tbart||Note Added: 50207|
|2021-03-10 22:43||ollehar||Assigned To||LouisGac =>|
|2021-03-10 22:43||ollehar||Status||assigned => feedback|
|2021-03-10 22:43||ollehar||Note Added: 63212|
|2021-03-11 10:40||tbart||Note Added: 63290|
|2021-03-11 10:40||tbart||File Added: limesurvey_survey_185162.lss|
|2021-03-11 10:40||tbart||File Added: österreich.png|
|2021-03-11 10:40||tbart||Status||feedback => new|
|2021-03-11 11:38||ollehar||Priority||none => high|