rootstrap / active-storage-base64

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

fix empty file decode issue #77

Closed Baaboud closed 8 months ago

Baaboud commented 8 months ago

Summary

issue

we get error when there is an empty file is uploaded the issue happens in the decode process for data part because it is empty

lib/active_storage_support/base64_attach.rb:22 decoded_data = Base64.decode64(data) here the data is nil and will get an error

Other Information

I think we should consider allowing empty data part to be blank like I did in my PR here or adding validation to allow or prevent empty files

santib commented 8 months ago

@Baaboud thanks for the PR. Can you add a test so we prevent regressions?