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

URI parser cannot parse nil path for CarrierWave::Storage::Fog::File#public_url #2724

Open
tpdogan opened this issue Feb 8, 2024 · 3 comments

Comments

@tpdogan
Copy link

tpdogan commented Feb 8, 2024

Hello there,

After upgrading to the latest version of carrierwave, CarrierWave::Storage::Fog::File#public_url started to raise undefined method 'gsub' for nil:NilClass for URI parser. It seems that this is due to this commit, which changed usage of path from path.to_s to path for #encode_path method. Thus, the use case of path being nil is not considered.

Following line

URI::DEFAULT_PARSER.escape(path, PATH_UNSAFE)

should be

URI::DEFAULT_PARSER.escape(path.to_s, PATH_UNSAFE)
@abepark01
Copy link

@tpdogan thanks! I changed the gem locally, but the fix worked for me. CC: @mshibuya

@abepark01
Copy link

@tpdogan @mshibuya I created a small PR to fix this regression per @tpdogan's insights.

@mshibuya mshibuya added the bug label Sep 15, 2024
@mshibuya
Copy link
Member

I'd like to understand one thing.
When path becomes nil? How do you configure CarrierWave to behave so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants