Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The tracdelight API does not work as advertised. Even if an image with the extension jpg is requested it might send a png. Although it is sending a correct Content-Type-Header it is not surprising that has not been detected before. Drupal relies on the file extension for determining the mime type and associating the wrong mime type can lead to unexpected results when applying image style effects.
Comment | File | Size | Author |
---|---|---|---|
#4 | wrong-mimetype-2680157-4.patch | 1.75 KB | Stefan Freudenberg |
Comments
Comment #2
Stefan Freudenberg CreditAttribution: Stefan Freudenberg at Agaric commentedComment #3
Stefan Freudenberg CreditAttribution: Stefan Freudenberg at Agaric commentedComment #4
Stefan Freudenberg CreditAttribution: Stefan Freudenberg at Agaric commentedThe attached patch addresses the above mentioned issue by saving the file with the extension corresponding to the content-type-header sent by tracdelight. It also removes an extraneous content-type-header from the GET request for fetching the images. The content-type-header refers to the entity sent with the request, not the desired format of the response. Please see https://tools.ietf.org/html/rfc2616#section-14.17 and https://tools.ietf.org/html/rfc2616#section-14.1.
Comment #5
Stefan Freudenberg CreditAttribution: Stefan Freudenberg at Agaric commentedComment #6
chr.fritschThanks for your work. You are right, we should fetch images independent of its file extension. But what about gifs and bmp or anything else? We should make this generic for all types.
Maybe should just check if content-type starts with 'image/' and the exclude the second part for the file extension?
Comment #7
chr.fritschThanks for that patch
Comment #9
drummCorrecting issue status, see #2698635: Issue statuses changing by themselves?.