mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FIX: Extension-less secure uploads (#29914)
Previously, the secure-upload redirection logic would fail for extension-less files. This commit updates it to work, and adds a spec for the behavior. Extension-less file uploads are not allowed by default, so this is a very niche situation.
This commit is contained in:
@ -605,6 +605,16 @@ RSpec.describe UploadsController do
|
||||
expect(response.redirect_url).to match("Amz-Expires")
|
||||
end
|
||||
|
||||
it "returns signed url for legitimate request with no extension" do
|
||||
upload.update!(extension: nil, url: upload.url.sub(".png", ""))
|
||||
sign_in(user)
|
||||
get secure_url
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response.redirect_url).to match("Amz-Expires")
|
||||
expect(response.location).not_to include(".?")
|
||||
end
|
||||
|
||||
it "should return secure uploads URL when looking up urls" do
|
||||
upload.update_column(:secure, true)
|
||||
sign_in(user)
|
||||
|
Reference in New Issue
Block a user