README.md in file_validators-3.0.0.beta1 vs README.md in file_validators-3.0.0.beta2
- old
+ new
@@ -140,12 +140,17 @@
```
* `exclude`: Forbidden content types. Can be a single content type or an array. Each type
can be a String or a Regexp. It also accepts `proc`. See `:allow` options examples.
* `mode`: `:strict` or `:relaxed`. `:strict` mode can detect content type based on the contents
of the files. It also detects media type spoofing (see more in [security](#security)).
-`:relaxed` mode uses file name to detect the content type using `mime-types` gem.
-If mode option is not set then the validator uses form supplied content type.
+`:file` analyzer is used in `:strict` model. `:relaxed` mode uses file name to detect
+the content type. `mime_types` analyzer is used in `relaxed` mode. If mode option is not
+set then the validator uses form supplied content type.
+* `tool`: `:file`, `:fastimage`, `:filemagic`, `:mimemagic`, `:marcel`, `:mime_types`, `:mini_mime`.
+You can choose one of these built-in MIME type analyzers. You have to install the analyzer gem you choose.
+By default supplied content type is used to determine the MIME type. This option takes precedence
+over `mode` option.
```ruby
validates :avatar, file_content_type: { allow: 'image/jpeg', mode: :strict }
validates :avatar, file_content_type: { allow: 'image/jpeg', mode: :relaxed }
```
* `message`: The message to display when the uploaded file has an invalid content type.
@@ -178,12 +183,12 @@
thus exposing your application to a security vulnerability. Media type spoof detector wont let that happen.
It will not allow a file having `image/jpeg` content type to be saved as `text/plain`. It checks only media
type mismatch, for example `text` of `text/plain` and `image` of `image/jpeg`. So it will not prevent
`image/jpeg` from saving as `image/png` as both have the same `image` media type.
-**note**: This security feature is disabled by default. To enable it, first add `terrapin` gem in
-your Gemfile and then add `mode: :strict` option in [content type validations](#file-content-type-validator).
+**note**: This security feature is disabled by default. To enable it, add `mode: :strict` option
+in [content type validations](#file-content-type-validator).
`:strict` mode may not work in direct file uploading systems as the file is not passed along with the form.
## i18n Translations
File Size Errors
@@ -199,10 +204,10 @@
* `excluded_file_content_types`: generated when you have specified excluded types and the content type
of the file matches anyone of them. takes `types` as replacement.
This gem provides `en` translations for this errors under `errors.messages` namespace.
If you want to override and/or create other locales, you can
-check [this](https://github.com/musaffa/file_validators/blob/master/lib/file_validators/locale/en.yml) out to see how translations are done.
+check [this](https://github.com/musaffa/file_validators/blob/master/lib/file_validators/locale/en.yml) out to see how translations are done.
You can override all of them with the `:message` option.
For unit format, it will use `number.human.storage_units.format` from your locale.
For unit translation, `number.human.storage_units` is used.