mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Mark secure media upload insecure automatically if used for theme component (#8413)
When uploading a file to a theme component, and that file is existing and has already been marked as secure, we now automatically mark the file as secure: false, change the ACL, and log the action as the user (also rebake the posts for the upload)
This commit is contained in:
@@ -230,9 +230,9 @@ class Upload < ActiveRecord::Base
|
||||
self.posts.where("cooked LIKE '%/_optimized/%'").find_each(&:rebake!)
|
||||
end
|
||||
|
||||
def update_secure_status
|
||||
def update_secure_status(secure_override_value: nil)
|
||||
return false if self.for_theme || self.for_site_setting
|
||||
mark_secure = should_be_secure?
|
||||
mark_secure = secure_override_value.nil? ? should_be_secure? : secure_override_value
|
||||
|
||||
self.update_column("secure", mark_secure)
|
||||
Discourse.store.update_upload_ACL(self) if Discourse.store.external?
|
||||
|
||||
Reference in New Issue
Block a user