Open LibrErli opened 2 months ago
The image seems to be of type PNG
:
$ curl -L 'https://commons.wikimedia.org/wiki/Special:FilePath/ZHB%20Luzern%20Logo%20farbig.svg?width=270' -o image
$ file image
image: PNG image data, 270 x 60, 8-bit colormap, non-interlaced
But lobid's imagesproxy tries to parse it, based on the file's name, as SVG
- which consequently fails.
What we can do: change the imagesproxy
to:
a) determine type of image by taking the content-type
header into account (and not just by parsing the URL to determine get the file's suffix)
b) get rid of all HTML parameter (?.*) - that would leave us with curl -L 'https://commons.wikimedia.org/wiki/Special:FilePath/ZHB%20Luzern%20Logo%20farbig.svg
which is a SVG
As a hip-shot I would say b) is easier to do, but then we might not fix all scenarios. On the other hand, a) may also be problematic, if not all images have a content-type
header. (b) could also be just a fallback if a URLs path is not ending with a dot + three characters (aka file extension).
What is the status of this, @phu2 @dr0i ?
E.g. ZHB Luzern retrieves as example image the logo image stored as *svg on Wikimedia Commons. It seems that the lobid-imageproxy has troubles with implementing svg correctly.