Skip to content

Commit

Permalink
don't show media previews for deleted attachments
Browse files Browse the repository at this point in the history
test plan:
* embed a link to a previewable media file in html content
(e.g. a wiki page)
* the media preview should work on the page
* delete the file
* the media preview should not be shown anymore

closes #CNVS-25285

Change-Id: I6e8fb5ad875ce62c51ca9ce6882df9d6239b053e
Reviewed-on: https://gerrit.instructure.com/68442
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <[email protected]>
Reviewed-by: Jeremy Stanley <[email protected]>
Product-Review: James Williams  <[email protected]>
  • Loading branch information
maneframe committed Dec 9, 2015
1 parent 765507f commit 940bce5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def api_user_content(html, context = @context, user = @current_user, preloaded_a
end
end

unless obj && ((is_public && !obj.locked_for?(user)) || user_can_download_attachment?(obj, context, user))
unless obj && !obj.deleted? && ((is_public && !obj.locked_for?(user)) || user_can_download_attachment?(obj, context, user))
if obj && obj.previewable_media? && (uri = URI.parse(match.url) rescue nil)
uri.query = (uri.query.to_s.split("&") + ["no_preview=1"]).join("&")
next uri.to_s
Expand Down

0 comments on commit 940bce5

Please sign in to comment.