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.
Hi @alawv_services, sorry for the delay on this. Here's the response I received from the dev team:
I think they're having this issue because of a recent change we passed.
.txtfiles they had are still opening in new tabs because they were here before we refactor of how we handles files. (inline mode)
.txtare being downloaded because this is how we prevent scripts from being executed on the Prismic editor. (attachment mode)
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.