I’m not sure is it global, but recently i’ve tried to attach an file in private message and send to one of the people on my discussion. Seems like Attachment is not working there. If anyone could confirm this problem i would appreciate so we can get fix for it. Thanks
Yes, I’ve just run into the same problem. A user sent me a .docx file per private message and the link was broken. However, the file was uploaded successfully and I used SFTP to download and read it.
@techapj can you look into this? Possibly related to recent upload changes, perhaps…
I can confirm this. Every new upload on my installation is affected after rebuilding container 10 hours ago.
I suppose that the problem is in a new path “/uploads/default/original/ 2X /…/hash”? Where is this 2X coming from? I had done “rake uploads:migrate_to_new_pattern” but it didn’t help.
EDIT: OK, I see from the routes.rb there is a new upload pattern (dir1/dir2) where every uploaded file is moved (/var/www/discourse/config/routes.rb
):
get "uploads/:site/original/:dir1/:dir2/:sha.:extension"
Files do exist locally (/shared/uploads/default/original/2X) but Discourse is not routing it right.
EDIT2: I’ve temporarily fixed it by changing the route constraints dir1: /[a-z0-9]/
to dir1: /[a-zA-Z0-9]+/
:
get "uploads/:site/original/:dir1/:dir2/:sha.:extension" => "uploads#show", constraints: { site: /\w+/, dir1: /[a-zA-Z0-9]+/, dir2: /[a-f0-9]/, sha: /[a-f0-9]{40}/, extension: /\w{2,}/ }
because “X2” cannot be matched with the default regexp setting. Hope to see the official fix soon
Thanks @dbm for reporting that issue and @adundovi for looking into it. I just pushed a fix
https://github.com/discourse/discourse/commit/73b8cfa7d7dbbb154a65e57505da47e4a618c668
What happens with old posts?
This new route is retrocompatible. I’ll work tomorrow on a rake task to migrate to the new pattern.