Subfolder issue with PDF uploads?

AI-generated summary

In a new Discourse subfolder installation, pfaffman reports a bug where PDF attachments linked within posts trigger an “Oops! That page doesn’t exist or is private” error — yet the same links work when opened in a new tab or incognito window. Other assets (images, etc.) function normally. pfaffman suspects a Rails routing issue specific to subfolder setups and notes the workaround is to reload the page or force attachments to open in new tabs. nbianca confirms the issue has been fixed in a recent commit (https://github.com/discourse/discourse/commit/861023f0d64d1ba26c07d42d24ad55315e50ed1b) and asks users to verify if the problem persists after updating.

This looks like a :bug:, but this is a new setup, so maybe I’ve done something wrong.

There is an upload attached to a post. If you click the link to download it, you get the “Oops! That page doesn’t exist or is private” page, but if you open that same link in a new window or tab (or an incognito window), it downloads just fine. All of the other images, assets, and so on seem to be working just fine.

The attachments are uploaded like this:


<a class="attachment" href="/community/uploads/default/original/1X/fa6c9075acd15300f12b16433becf2137e29227d.pdf">original-filename.pdf</a> (113.6 KB)

(Using safe-mode didn’t help.)

EDIT: I’m moving this to the bug category. Can anyone with sub-folder see if they can download attachments?

My word-around for now is to change the “oops” message to include the recommendation to reload the page. I think that if I knew any CSS I might be able to have class="attachment" open in a new tab, which would solve the problem.

This is a new subfolder installation, so it could be that something is amiss in the configuration, but when I’ve seen the “it’s an oops when linked internally but works fine when linked externally” , it’s been a rails routing problem. Since all other assets and links seem to be working this seems like a subfolder bug. (and I just deleted the old instance so I can’t upgrade and test there :crying_cat_face:)

Can anyone else with a subfolder instance confirm or deny a problem with non image attachments?

I have fixed this issue in FIX: Skip attachments in click track. · discourse/discourse@861023f · GitHub.

Can you please check again and report if it still reproduces?