forked from shrinerb/shrine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose methods for determining MIME type
It's useful for developers building a file attachment flow to just be able to just extract MIME type from an IO object, and use that value for their own purposes. Therefore we expose `Shrine.determine_mime_type` and `Shrine.mime_type_analyzers` methods: Shrine.determine_mime_type(io) # calls the defined analyzer #=> "image/jpeg" Shrine.mime_type_analyzers[:file].call(io) # calls a built-in analyzer #=> "image/jpeg" During refactoring we extract mime type analyzing from the uploader into a separate class, to avoid polluting the uploader with methods. We also remove the :magic_header plugin option, because users shouldn't have know about that. If the magic header size turns out to be too small for certain file types, we'll bump the number up in Shrine directly. The :magic_header option wasn't documented.
- Loading branch information
Showing
3 changed files
with
99 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters