/uploads: set referrerpolicy=no-referrer on hotlinked previews.

Don't send the referer when hotlinking preview images on the
/uploads/new page. Improves user privacy and may bypass anti-hotlinking
protections in some cases.
This commit is contained in:
evazion
2019-10-07 13:44:35 -05:00
parent 8209a75e95
commit 1518c7aad6

View File

@@ -1,9 +1,9 @@
<% if params[:url] %>
<div id="upload-image">
<% if ImageProxy.needs_proxy?(@source.image_url) %>
<%= image_tag(image_proxy_uploads_path(:url => @source.image_url), :title => "Preview", :id => "image") %>
<%= tag.img src: image_proxy_uploads_path(url: @source.image_url), title: "Preview", id: "image" %>
<% elsif @source.image_url.present? %>
<%= image_tag(@source.image_url, :title => "Preview", :id => "image") %>
<%= tag.img src: @source.image_url, title: "Preview", id: "image", referrerpolicy: "no-referrer" %>
<% end %>
</div>