active_storage_validations
active_storage_validations copied to clipboard
Dimension validator not working
Hi! I am having a problem with the dimension validator where this line causes the exception NoMethodError (undefined method
id' for nil:NilClass)`.
Any idea of how to fix? Thanks!
ps. I'm on Rails master if that's relevant.
Adding that I am doing direct upload to S3.
I debugged the code and it passes in a string that is super long (eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBGZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--0d6f6469d9e6acf521c4bb6aeb460a4997419115), and causes an issue on line 24 of Metadata.rb, where ActiveStorage::Blob.find_signed(file) returns nil.
Not sure how to proceed, as it seems like this is an ActiveRecord issue, and I'm not really sure how to solve it!
Sorry to double post, on a whim I changed the code on Metadata.rb on 24 to add the ! (as In could not find a method ActiveStorage::Blob.find_signed without the bang) and it works, e.g. change
blob = is_string ? ActiveStorage::Blob.find_signed(file) : file
to
blob = is_string ? ActiveStorage::Blob.find_signed!(file) : file
@mmotherwell please prepare a PR with a fix. And I'll merge it
Is it not in master? Should I just get the tests passing?
Hi everyone, I think this issue has been solved by https://github.com/igorkasyanchuk/active_storage_validations/commit/b84dfeaba49d948ad15822a582286577a96cfa61 in December 2020. @mmotherwell, @consitently, @vitobotta let me know if that's not the case, otherwise I'll close this issue by week's end considering it's been solved in order to clean up the gem backlog.