rootstrap / active-storage-base64

Base64 support for ActiveStorage
https://rootstrap.com
MIT License
160 stars 16 forks source link

NoMethodError: undefined method `unpack1' for nil:NilClass #76

Closed Baaboud closed 8 months ago

Baaboud commented 9 months ago

we get this error when there is an empty file is uploaded in our application because the data part is blank for example "data":"data:text/plain;base64,"

sometimes we are expecting empty files to be uploaded

I think we should consider allowing empty data part to be blank or adding validation to allow or prevent empty files

lib/active_storage_support/base64_attach.rb:22
decoded_data  = Base64.decode64(data || '')
santib commented 9 months ago

Hi @Baaboud thanks for the report. Do you want to open a PR with the fix?

Baaboud commented 8 months ago

yes @santib I opened this PR for this issue please check it when you have time

santib commented 8 months ago

Fixed by #77