FIX: Upload's content is the only source of truth for the file type.

This commit is contained in:
Guo Xiang Tan
2018-08-07 13:15:00 +08:00
parent d1860a4f7d
commit 2b57239389
4 changed files with 26 additions and 8 deletions

View File

@ -107,14 +107,12 @@ class UploadsController < ApplicationController
else
tempfile = file.tempfile
filename = file.original_filename
content_type = file.content_type
end
return { errors: [I18n.t("upload.file_missing")] } if tempfile.nil?
opts = {
type: type,
content_type: content_type,
for_private_message: for_private_message,
pasted: pasted,
}