Univention Bugzilla – Bug 35062
UMC icon registration fails for .svgz
Last modified: 2020-08-20 16:25:56 CEST
# cat /var/log/univention/join.log E: Invalid Syntax: icon: Not a supported image format: application/x-gzip $ grep -n -B 5 "Not a supported" base/univention-lib/python/umc_module.py 25-def compression_mime_type_of_buffer(data): 26- mime_type = get_mime_type(data) 27- if mime_type in compression_mime_type_handlers: 28- return (mime_type, compression_mime_type_handlers[mime_type]) 29- else: 30: raise univention.admin.uexceptions.valueError( "Not a supported compression format: %s" % (mime_type,)) -- 43-def image_mime_type_of_buffer(data): 44- mime_type = get_mime_type(data) 45- if mime_type in ('image/jpeg', 'image/png', 'image/svg+xml'): 46- return mime_type 47- else: 48: raise univention.admin.uexceptions.valueError( "Not a supported image format: %s" % (mime_type,))
.svgz is explicitly mentioned in <http://docs.univention.de/developer-reference-3.2.html#settings:udm_module> (and other sections)
MIME-Type was not regognised correctly, and the listener module which is reponsible for UDM extensions, was not capable of converting .svgz to .png. svn 51405: univention-lib (3.0.26-21) & univention-directory-manager-modules (9.0.76-7) svn 51404: UCS 4.0-0 merge svn 51406: YAML
> # cat /var/log/univention/join.log > E: Invalid Syntax: icon: Not a supported image format: application/x-gzip A bit more context would strictly be great for bug reports. Without that I don't understand the issue and the fix completely yet. Please correct my if you disagree with these points: > MIME-Type was not regognised correctly, and the listener module which is > reponsible for UDM extensions, was not capable of converting .svgz to .png. * The function imagecategory_of_buffer uncompresses the data and sends the uncompressed data though the function image_mime_type_of_buffer, so the later should not return 'application/x-gzip' unless somebody fed double compressed image data to the function? * In my standard UCS installation the directory /usr/share/univention-management-console-frontend/js/dijit/themes/umc/icons/scalable/ contains *only* svgz files, so no conversion to png should be necessary for the files deposited there. * If an image conversion is really not avoidable, I would strictly prefer to do this in the frontend routines (ucs_registerLDAPExtension etc), rather than in the listener module to be able to return error feedback to the user.
(In reply to Arvid Requate from comment #3) > > # cat /var/log/univention/join.log > > E: Invalid Syntax: icon: Not a supported image format: application/x-gzip > > A bit more context would strictly be great for bug reports. "ucs_registerLDAPExtension ... --icon *.svgz" is used by 65univention-ox.inst. This is mentioned in the developer reference: > The option --icon can be used to supply icon files (png or jpeg, in 16x16 or 50x50, or svgz). This then leads to the above mentioned error. 1. So the developer reference and the code should be changed to clarify, that an uncompressed SVG must be supplied, 2. or image_mime_type_of_buffer() needs to handle the double-compression case, 3. or the compression should be skipped for .svgz files 4. or the library should be changed to un-compress .svgz files before adding them into LDAP.
(In reply to Arvid Requate from comment #3) > * The function imagecategory_of_buffer uncompresses the data and sends the > uncompressed data though the function image_mime_type_of_buffer, so the > later should not return 'application/x-gzip' unless somebody fed double > compressed image data to the function? Absolutely correct. Providing a regular .svgz file leads to double compressed data being passed to the function. > * In my standard UCS installation the directory > /usr/share/univention-management-console-frontend/js/dijit/themes/umc/icons/ > scalable/ contains *only* svgz files, so no conversion to png should be > necessary for the files deposited there. UMC needs the PNG files below umc/icons/[16x16|50x50] in order to use them -> the listener module should create these files because, if I am getting this right, it's purpose is to apply LDAP changes to the system.
I've reverted the changes made for now.
(In reply to Philipp Hahn from comment #1) > .svgz is explicitly mentioned in > <http://docs.univention.de/developer-reference-3.2.html#settings:udm_module> > (and other sections) For .svgz/.svg images to be sufficient, the udm_extension listener module would have to convert this images to PNG files, which the UMC needs to display the module in the frontend. This would only be possible by using using tools from libmagick which are currently unmaintained and thus UDM should not depend on them. We should rather adapt the documentation: Bug #35250
register_ldapExtension should maybe validate the input to ensure that users cannot break things. I.e. we shoud check that > UMC needs at least two .png files (16x16x and 50x50)
See /usr/lib/univention-directory-listener/system/udm_extension.py: ======================= from univention.lib.umc_module import imagecategory_of_buffer (mime_type, compression_mime_type, dimension_string) = imagecategory_of_buffer(object_data) ======================= dimension_string is either "50x50" (or similar) or "scalable". Maybe we can simply use that in univention.lib.ldap_extension.
This issue has been filed against UCS 3. UCS 3 is out of the normal maintenance and many UCS components have vastly changed in UCS 4. If this issue is still valid, please change the version to a newer UCS version otherwise this issue will be automatically closed in the next weeks.
This issue has been filed against UCS 4.2. UCS 4.2 is out of maintenance and many UCS components have changed in later releases. Thus, this issue is now being closed. If this issue still occurs in newer UCS versions, please use "Clone this bug" or reopen it and update the UCS version. In this case please provide detailed information on how this issue is affecting you.
*** This bug has been marked as a duplicate of bug 51594 ***