cloudinary / cloudinary/cloudinary_gem

Tags with special URI characters are not readable

Offen
#299 1 Kommentar 0 Reaktionen 1 zugewiesene Person Beansprucht von @aleksandar-cloudinary Auf GitHub ansehen
bug
Vorherrschende Sprache
Ruby
Sterne
420
Forks
285
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

```ruby
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](https://github.com/cloudinary/cloudinary_gem/blob/23e94073719732701915c68a12ff68afaaa32650/lib/cloudinary/api.rb#L51).

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.