mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-11 07:03:34 +08:00
Make previewable document filter more strict [SCI-3817]
This commit is contained in:
parent
0a8c101c7e
commit
c65c0cf356
1 changed files with 4 additions and 2 deletions
|
@ -63,9 +63,11 @@ Paperclip::Attachment.class_eval do
|
||||||
end
|
end
|
||||||
|
|
||||||
def previewable_document?
|
def previewable_document?
|
||||||
previewable = Constants::PREVIEWABLE_FILE_TYPES.include?(content_type)
|
extensions = %w(.txt .pdf .xlsx .docx .pptx .xls .rtf .doc .ppt .odt .ods .odp)
|
||||||
|
|
||||||
|
previewable = Constants::PREVIEWABLE_FILE_TYPES.include?(content_type) &&
|
||||||
|
extensions.include?(File.extname(original_filename))
|
||||||
|
|
||||||
extensions = %w(.xlsx .docx .pptx .xls .doc .ppt)
|
|
||||||
# Mimetype sometimes recognizes Office files as zip files
|
# Mimetype sometimes recognizes Office files as zip files
|
||||||
# In this case we also check the extension of the given file
|
# In this case we also check the extension of the given file
|
||||||
# Otherwise the conversion should fail if the file is being something else
|
# Otherwise the conversion should fail if the file is being something else
|
||||||
|
|
Loading…
Reference in a new issue