cloudinary_gem icon indicating copy to clipboard operation
cloudinary_gem copied to clipboard

Tags with special URI characters are not readable

Open jqr opened this issue 7 years ago • 1 comments

Tags that contain non-uri-component-safe characters are not readable using the resources_by_tag method. Example:

tag = 'with/some?bad=characters'
Cloudinary::Uploader.upload(url, tags: [tag]) # correctly encodes value

# will not see the upload
Cloudinary::Api.resources_by_tag(tag) 
# because uri = "resources/#{resource_type}/tags/#{tag}"

# Work around, will see the upload
Cloudinary::Api.resources_by_tag(URI.encode_www_form_component(tag)) 

This looks to be caused by assembling the URI without encoding.

I'm opening an issue rather than a pull request because the code seems to have a lot of direct URI assembling, so the issue almost certainly exists elsewhere in the code. Most sites seem to have more constrained elements (type, public_id, etc.), but it does not hurt to encode them too.

jqr avatar Apr 09 '18 15:04 jqr

Hi,

Thanks for bringing this to our attention. I have submitted this issue to our devs and will provide updates on this issue.

Thanks again!

marissa-masangcay avatar Apr 09 '18 23:04 marissa-masangcay