Private Message Attachment Issue


#1

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 :wink:


(Michael Hrenka) #2

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.


(Jeff Atwood) #3

@techapj can you look into this? Possibly related to recent upload changes, perhaps…


(4ndY) #4

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 :wink:


(Jeff Atwood) #5

Yeah @zogstrip and @sam this should be looked into.


(Régis Hanol) #6

Thanks @dbm for reporting that issue and @adundovi for looking into it. I just pushed a fix :rabbit:

https://github.com/discourse/discourse/commit/73b8cfa7d7dbbb154a65e57505da47e4a618c668


(Régis Hanol) #7

(Sam Saffron) #8

What happens with old posts?


(Régis Hanol) #9

This new route is retrocompatible. I’ll work tomorrow on a rake task to migrate to the new pattern.