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 subject says it all but just to keep this into context - if the node/1/attachment link points to a text or an image file then instead of the 'normal' behavior of browsers rendering the view for them inside the browser these txt/image files get downloaded.
We found it a bit annoying so worked on a fix to maintain this original behavior while still working with this module.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1856422-2-maintain-content-type.patch | 1.29 KB | lirantal |
#1 | 1856422-1-maintain-content-type.patch | 1.17 KB | lirantal |
Comments
Comment #1
lirantal CreditAttribution: lirantal commentedSuggested fix for this issue.
Comment #2
lirantal CreditAttribution: lirantal commentedActually the above will cause the file to be downloaded as 'attachment' so it's not a proper fix.
This new patch will detect if the file is of mime type for plain text/pdf and will open in the browser, otherwise it will force a download (with the correct file name).
Comment #3
ruplHey there, thanks for the report accompanied by a patch! Unfortunately I cannot detect any change in the module's behavior with the patch applied. The header info doesn't change at all when I check in my browser devtools, nor does a PDF load automatically in the browser window.
Could you provide me with some steps to reproduce the outcome you expect?
Comment #4
lirantal CreditAttribution: lirantal commentedYou're welcome :)
It was my mistake to mention the PDF example as that was not taken care of but rather what should open in the browser is a text file or an image. So try uploading a readme.txt or an image.jpg and then fetch it with the attachment links URL and they should open inside the browser instead of being downloaded.
Comment #5
apadernoI am closing this issue, as Drupal 6 is now not supported.