Skip to content
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

fix empty file decode issue #77

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

Baaboud
Copy link
Contributor

@Baaboud Baaboud commented Jan 8, 2024

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
Copy link
Member

santib commented Jan 8, 2024

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

@amaury901130 amaury901130 self-requested a review January 9, 2024 15:48
Copy link
Member

@santib santib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow! thanks for covering all the cases 🙌

@santib santib merged commit ff00238 into rootstrap:master Jan 17, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants