Skip to content

Commit

Permalink
Fix mime type issue in MS windows
Browse files Browse the repository at this point in the history
This change should accompish the commits a4969be and 6544880.
Basically we make an exception for bzip2 files, in a way that
they may come as octet stream.
  • Loading branch information
Aleksei Burlakov committed Sep 26, 2023
1 parent 1ff135e commit 004af5a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hawk/app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ class Upload < Tableless
attribute :upload, ActionDispatch::Http::UploadedFile

validate do |record|
# Windows doens't understand bzip2 and sends them as blob,
# so let's make an exception.
if record.upload.content_type == "application/octet-stream"
next if record.upload.original_filename =~ /^[a-zA-Z0-9_-]+\.tar\.bz2\z/
end
unless ["application/gzip",
"application/x-gzip",
"application/x-bzip",
Expand Down

0 comments on commit 004af5a

Please sign in to comment.