Skip to content

[Bug] Double encoding of commas in public IDs #414

@charliemourant

Description

@charliemourant

Bug Report

Describe the bug

When using CldImage, passing a public ID containing a comma will create result in an tag where the comma is double encoded in the cloudinary url.

Steps To Reproduce the error

  1. Render a CldImage with a public id containg a comma e.g. "Lucha libre, Tacos and Beer4"
  2. Check dev tools in the browser and see the src for the rendered tag will be something like "https://res.cloudinary.com/dtljonz0f/image/upload/c_fill,w_592,h_294,g_auto/f_auto/q_auto/v1/gc-v1/cancun/Lucha%20libre%252C%20Tacos%20and%20Beer4?_a=BAVAcNE40", where you can see the comma has been double encoded to %252C

Expected behaviour

The src in the image tag should contain a single encoded comma e.g. "https://res.cloudinary.com/dtljonz0f/image/upload/c_fill,w_592,h_294,g_auto/f_auto/q_auto/v1/gc-v1/cancun/Lucha%20libre%2C%20Tacos%20and%20Beer4?_a=BAVAcNE40"

Additional context

Having looked into the issue I am fairly sure the root cause is that the constructCloudinaryUrl function in your cloudinary-util library is still using a version of cloudinary/js-url-gen before they fixed [this](cloudinary/js-url-gen#575) issue with comma encoding.

I see that you implemented a fix for part of the issue following this bug report. But the issue remains if a completely unencoded public Id contains a comma.

Would you be able to release a new version with the dependency updated to beyond 1.12.1? We love everything else about the library and would like to switch to using again!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions