Bug 35062 - UMC icon registration fails for .svgz
UMC icon registration fails for .svgz
Status: RESOLVED DUPLICATE of bug 51594
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 4.2
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-05 09:00 CEST by Philipp Hahn
Modified: 2020-08-20 16:25 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2014-06-05 09:00:48 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,))
Comment 1 Philipp Hahn univentionstaff 2014-06-05 09:02:45 CEST
.svgz is explicitly mentioned in <http://docs.univention.de/developer-reference-3.2.html#settings:udm_module> (and other sections)
Comment 2 Lukas Walter univentionstaff 2014-07-01 16:13:43 CEST
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
Comment 3 Arvid Requate univentionstaff 2014-07-02 19:42:05 CEST
> # 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.
Comment 4 Philipp Hahn univentionstaff 2014-07-03 09:14:38 CEST
(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.
Comment 5 Lukas Walter univentionstaff 2014-07-03 11:34:05 CEST
(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.
Comment 6 Lukas Walter univentionstaff 2014-07-03 12:49:35 CEST
I've reverted the changes made for now.
Comment 7 Lukas Walter univentionstaff 2014-07-03 17:02:48 CEST
(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
Comment 8 Arvid Requate univentionstaff 2014-07-09 16:23:55 CEST
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)
Comment 9 Arvid Requate univentionstaff 2014-09-01 15:41:11 CEST
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.
Comment 10 Stefan Gohmann univentionstaff 2017-06-16 20:38:49 CEST
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.
Comment 11 Ingo Steuwer univentionstaff 2020-07-03 20:51:20 CEST
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.
Comment 12 Florian Best univentionstaff 2020-08-20 16:25:56 CEST

*** This bug has been marked as a duplicate of bug 51594 ***