Univention Bugzilla – Bug 36846
Uploading files in distribution: Umlauts do not work
Last modified: 2023-07-03 12:35:59 CEST
Files with umlauts in their name do not work in distribution. They do not show up in the file system after uploading (but they are saved somehow). Interestingly, this action (uploading an umlaut containing file) *distributes an undistributed project* immediately. Firefox. Filename was "companyName_ Wichtige Änderung.PDF"
May be the space in the file name, though...
The problem here is cherrypy. It converts the bytestring b'companyName_ Wichtige \xc3\x84nderung.PDF' into the unicode object u'companyName_ Wichtige \xc3\x84nderung.PDF' instead of u'companyName_ Wichtige \xc4nderung.PDF'. The frontend has the filename in javascript and sends it via JSON to the module (which is then UTF-8, maybe also depending on the OS and browser locale?). In the module it mismatches then name because it is written to the harddisk with the first bytestring-name.
"90_ucsschool/18_distribute_materials_encoding" written for bug #37694 should test such cases, please enable it after this one is fixed.
@Sönke: Should we add a workaround in the module so that this will work immediately or should we wait for the patch applied at Bug #37716 which will automatically fix this? The exam mode is also broken in the same way. The patch there has no side effect as the only modules in UCS and UCS@school which uses the filename attribute are ucs-school-umc-distribution and ucs-school-umc-exam.
Created attachment 6679 [details] patch
Please apply the patch for the distribution and the exam module.
As Bug #37716 is tagged to UCS 4.0-x added the workaround from the patch for both packages (ucs-school-umc-exam, ucs-school-umc-distribution) supporting fixed and unfixed Bug #37716 in svn r58131.
Missing self in function signature __workaround_filename_bug(file) inside schoolexam/__init__.py TRACEBACK: Die Ausführung des Kommandos schoolexam/upload ist fehlgeschlagen: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/modules/__init__.py", line 176, in _decorated return function(self, request, *args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 626, in _response return function(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolexam/__init__.py", line 108, in upload filename = self.__workaround_filename_bug(file) TypeError: __workaround_filename_bug() takes exactly 1 argument (2 given)
fixed, packages are building
OK - debian/changelog OK - changelog OK - Files with umlauts -- tested: --- distribution module: utf8 and latin1 with umlauts --- distribution module: latin1 broken umlaut char --- exam module: utf8 and latin1 with umlauts --- exam module: latin1 broken char
UCS@school 4.0 v2 has been released: http://docs.univention.de/release-notes-ucsschool-4.0v2-de.html If this error occurs again, please use "Clone This Bug".