Skip to content

Commit

Permalink
Add workaround for Active Storage misidentifying file blob content ty…
Browse files Browse the repository at this point in the history
…pe as pdf

- Bug  with the signature for WMV2
- Magic priority for WMV is 60 but PDF is only 50 https://github.com/rails/marcel/blob/8e285636063d3617df6f73bc73de6574d83a53d5/data/tika.xml#L673-L693
- This workaround will identify a PDF and check to see if the bug is still present before removing the rule
  • Loading branch information
benbaumann95 committed Sep 29, 2022
1 parent abff87f commit 8f0cb5e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/initializers/marcel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# config/initializers/marcel.rb

# NOTE: https://github.com/rails/marcel/issues/77
if Marcel::MimeType.for("%PDF-1.6.%wmv2") == 'video/x-ms-wmv'
Marcel::Magic.remove('video/x-ms-wmv')
end

0 comments on commit 8f0cb5e

Please sign in to comment.