I have several txt files that I've uploaded as media items and linked to a custom slice instance. All of them but one will open in a new browser window. However, this one file will only be downloaded by the browser. Examining the file headers, I see that the txt files that open in the browser have content-disposition: inline, while the one that downloads has content-disposition: attachment. What would cause the difference when uploading to prismic? The file encoding is the same for all of the files.
Hi @alawv_services. This is strange, I’d like to take a closer look. Can you send me the following so that I can try to recreate this?
- Two text files: one that is working properly and the one that isn’t
- The code for how you’re adding the download links to your site
With that I will try to investigate how this all works and what can be done about it.
I’ve attached 2 text files. I know their filenames aren’t ideal, but I’ve chosen 2 with similar names. “Tobacco & Vaping.txt” opens in a new tab. “Talking to Friends & Family About Quitting.txt” only downloads.
They are being added to the slice as media links, and I am grabbing the url property in code and inserting it into an anchor tag in the format
<a href="MEDIA_FILE_URL" target="_blank">.
You can see these in action on this preview. Scroll down to the video gallery.
text_files.zip (9.0 KB)
Hi @alawv_services, I took a look and was able to recreate the issue, but I wasn’t able to figure out why this is happening or how to fix it.
I’ll have to pass it over to the @team-tech-support. Someone there will look into this as soon as they are able.
They will let you know if they have any followup questions when they pick this up from their queue.
Update: the preview listed above has been published. It can now be seen on the live page.