mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 01:55:46 +08:00
FIX: Change secure media to encompass attachments as well (#9271)
If the “secure media” site setting is enabled then ALL files uploaded to Discourse (images, video, audio, pdf, txt, zip etc. etc.) will follow the secure media rules. The “prevent anons from downloading files” setting will no longer have any bearing on upload security. Basically, the feature will more appropriately be called “secure uploads” instead of “secure media”. This is being done because there are communities out there that would like all attachments and media to be secure based on category rules but still allow anonymous users to download attachments in public places, which is not possible in the current arrangement.
This commit is contained in:
@ -356,8 +356,7 @@ describe Upload do
|
||||
expect(upload.secure).to eq(false)
|
||||
end
|
||||
|
||||
it 'marks a local attachment as secure if prevent_anons_from_downloading_files is enabled' do
|
||||
SiteSetting.prevent_anons_from_downloading_files = true
|
||||
it 'marks a local attachment as secure if secure media enabled' do
|
||||
SiteSetting.authorized_extensions = "pdf"
|
||||
upload.update!(original_filename: "small.pdf", extension: "pdf", secure: false, access_control_post: Fabricate(:private_message_post))
|
||||
enable_secure_media
|
||||
@ -368,8 +367,7 @@ describe Upload do
|
||||
expect(upload.secure).to eq(true)
|
||||
end
|
||||
|
||||
it 'marks a local attachment as not secure if prevent_anons_from_downloading_files is disabled' do
|
||||
SiteSetting.prevent_anons_from_downloading_files = false
|
||||
it 'marks a local attachment as not secure if secure media enabled' do
|
||||
SiteSetting.authorized_extensions = "pdf"
|
||||
upload.update!(original_filename: "small.pdf", extension: "pdf", secure: true)
|
||||
|
||||
@ -379,7 +377,7 @@ describe Upload do
|
||||
expect(upload.secure).to eq(false)
|
||||
end
|
||||
|
||||
it 'does not change secure status of a non-attachment when prevent_anons_from_downloading_files is enabled' do
|
||||
it 'does not change secure status of a non-attachment when prevent_anons_from_downloading_files is enabled by itself' do
|
||||
SiteSetting.prevent_anons_from_downloading_files = true
|
||||
SiteSetting.authorized_extensions = "mp4"
|
||||
upload.update!(original_filename: "small.mp4", extension: "mp4")
|
||||
|
Reference in New Issue
Block a user