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

gsub exception from normalize_headers with carrierwave #720

Closed
jnnttlpcktw opened this issue Aug 21, 2024 · 2 comments
Closed

gsub exception from normalize_headers with carrierwave #720

jnnttlpcktw opened this issue Aug 21, 2024 · 2 comments

Comments

@jnnttlpcktw
Copy link

I am not totally confident of what's happening, but we recently switched our carrierwave to use fog and we're seeing this error come up a TON.
undefined method 'gsub' for nil:NilClass

Relevant backtrace is always

fog-aws-3.22.0/lib/fog/aws/models/storage/files.rb:128→ normalize_headers
fog-aws-3.22.0/lib/fog/aws/models/storage/files.rb:111→ head
carrierwave-2.1.1/lib/carrierwave/storage/fog.rb:494→ file

I assume it doesn't have an ETag at that point. I'm guessing that the file is there, otherwise .head_object would be returning an error.

I'm surprised I haven't seen this mentioned elsewhere, which makes me worried it's something specific to our app.

At the very least, since fetch_and_delete_header has the potential to return nil, shouldn't we safeguard calling gsub on the return value there?

VERSIONS
ruby 3.0.5
rails 7.0.5.1
fog-aws 3.22.0
carrierwave 2.1.1
carrierwave-backgrounder 0.4.2

geemus added a commit that referenced this issue Aug 29, 2024
@geemus
Copy link
Member

geemus commented Aug 29, 2024

@jnnttlpcktw thanks for calling this out, I also am not sure why you would be seeing this in particular. But it also seems like a buggy part of the code that we don't check for nil before trying to gsub, so seems safe/easy enough to fix.

@geemus geemus closed this as completed in fddd974 Aug 29, 2024
@geemus
Copy link
Member

geemus commented Aug 29, 2024

Released in v3.25.0.

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

No branches or pull requests

2 participants