Skip to content

Commit

Permalink
Merge pull request #271 from aleksei-burlakov/fix-bzip2-in-windows
Browse files Browse the repository at this point in the history
Fix mime type issue in MS windows
  • Loading branch information
aleksei-burlakov authored Oct 10, 2023
2 parents 1ff135e + 2edaf87 commit 20ee324
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 octet-stream,
# so let's make an exception for bzip2 and let them be octet-stream.
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 20ee324

Please sign in to comment.