This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
MIME type detection of Paperclip::MediaTypeSpoofDetector doesn't work with old versions of file #2527
Comments
Fun fact 1The file_command_content_type_detector.rb contains another implementation of the type_from_file_command method:
The regexp of this implementation works correctly, because the whitespace character is already part of the character class. Fun fact 2The original implementation of Paperclip::MediaTypeSpoofDetector used the |
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
vakuum
pushed a commit
to vakuum/paperclip
that referenced
this issue
Jan 13, 2018
… with old versions of file. Please see thoughtbot#2527 for details.
I created a pull request for this issue: #2528. |
sidraval
pushed a commit
that referenced
this issue
Jan 30, 2018
… with old versions of file. Please see #2527 for details.
sidraval
pushed a commit
that referenced
this issue
Jan 30, 2018
… with old versions of file. Please see #2527 for details.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In old versions of file a space is used to separate the MIME type from the encoding:
In new versions of file a semicolon is used to separate the MIME type from the encoding:
In media_type_spoof_detector.rb the split method is used to separate the MIME type from the encoding:
But this doesn't work for old versions of file because the regexp doesn't match the space correctly:
Moving the whitespace character into the character class solves the problem:
Monkey patch
Currently I am using the following monkey patch as a workaround:
The text was updated successfully, but these errors were encountered: