From 5dc6100acca6a5872aeaa65b6cf80aeae59855e0 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Thu, 20 Feb 2020 10:57:40 +1000 Subject: [PATCH] Work around deleted upload.access_control_post scoping issue * TODO to come back and deal with this in a better way, it just needs to be done for the rake task to set secure media to work correctly --- lib/upload_security.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/upload_security.rb b/lib/upload_security.rb index 039b03d158b..86647892372 100644 --- a/lib/upload_security.rb +++ b/lib/upload_security.rb @@ -60,6 +60,9 @@ class UploadSecurity # if there is no access control post id and the upload is currently secure, we # do not want to make it un-secure to avoid unintentionally exposing it def access_control_post_has_secure_media? + # if the post is deleted the access_control_post will be blank... + # TODO: deal with this in a better way + return false if @upload.access_control_post.blank? @upload.access_control_post.with_secure_media? end