-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatible with content_type_whitelist? #40
Comments
actually this should work already, if you defined |
I tried it, but I didn't get it to work. I declared it as following in my uploader:
and then uploading a pdf file, but it was rejected due to incorrect content type. Then I thought it had something to do with the base64 conversion. |
I'm having the same issue. Using this in my Uploader. def content_type_whitelist
/image\//
end Is there any status on this? |
Planning to work on this in this weekend. |
Issue won't reproduce with current version of gem (2.5.3 at the moment) and carrierwave v1.1.0, tested with rails 5.1 and 4.2.8 |
I've tried both ways - regex and array (except not with pdf but with image/png and image/jpeg), and it worked in all cases ¯_(ツ)_/¯ |
@bobishh okey, thank you, I'm closing this issue then |
Great! If I have the time to check I will let you know if I can solve this issue by upgrading the gems. |
@bobishh @lebedev-yury I still fail to get this to work. I guess I'm doing some stupid mistake... I had a look at the readme for the
If I add the above code and then try to attach a pdf file to the attachment, it fail with the following error: |
I have solved the mystery. I tried in the console and it worked. Then I thought maybe something is wrong with my tests, and I were correct. Before I added the file with |
Sorry to bother you again but now when I tried a real upload, it still doesn't work, (though my tests are now working). I guess that means that the error is in the frontend. I'll have to continue my research... I'll be back if I get it to work. If someone wants to look at it, this is my parameters sent to the controller:
This is the error I get:
This is my content_type_whitelist:
|
@ehannes the parameters look fine. I will take a look at the issue, if I will find time on this weekend |
@ehannes did you figure out what was going on or how to figure out the file name the whitelist is checking against? Have a similar issue where I'm getting the error:
so it's stripping out the mime type somewhere and leaving it blank - would love some troubleshooting help if you figured out how to access the file name for a base64 uploaded file. My JSON file being submitted: Wondering if this is impacted by changing my photo.rb file to use image_filename to populate the filename
|
@goelinsights No, actually I have not fixed this yet... |
alternative to validate content_type : Add in model : |
Using this gem, can I use carrierwave's
content_type_whitelist
somehow?The text was updated successfully, but these errors were encountered: