uploads: fix incorrect remote sizes on pixiv uploads.

Bug: the uploads page showed a remote size of 146 bytes for Pixiv uploads.

Cause: we didn't spoof the Referer header when making the HEAD request
for the image, causing Pixiv to return a 403 error.

Also fix the case where the Content-Length header is absent.
This commit is contained in:
evazion
2020-06-24 02:54:30 -05:00
parent 8eac82a971
commit 4074cc99f9
5 changed files with 14 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
<% if params[:url] %>
<p id="upload-image-metadata">
<strong>Size</strong>
<% if @remote_size %>
<% if @remote_size.present? %>
<span id="upload-image-metadata-filesize"><%= number_to_human_size(@remote_size) %></span>
<% end %>
<span id="upload-image-metadata-resolution"></span>