cloudinary_npm icon indicating copy to clipboard operation
cloudinary_npm copied to clipboard

cloudinary.url is generating the wrong url

Open kangaroo5383 opened this issue 6 years ago • 2 comments

For cloudinary.url(fileKey, transform)

instead of a url that looks something like https://res.cloudinary.com/[accout_id]/image/upload/c_scale,w_114/v[some numbers]/scale-files-dev/releases/15/sets/14/0.jpg

It always defaults to v1 instead of v[some numbers]

kangaroo5383 avatar Feb 28 '20 04:02 kangaroo5383

Hi @kangaroo5383. This is actually the default behaviour of the SDKs (to include a 'v1') when the resource you're requesting a URL to be generated for is within a folder. If you are supplying a public_id without a folder then no version component would be included. This is the default URL format that is sent for invalidations at the CDN and therefore why the SDKs also generate it this way by default. You can read more about this here - https://support.cloudinary.com/hc/en-us/articles/360001208732-What-URL-conventions-are-invalidated

If you want to use the full version number then you would need to pass that as a parameter in the method call explicitly. Alternatively, you can use the force_version:false parameter in the global SDK configuration or per cloudinary.url call to omit the version number (both full and 'v1') out of the generated URLs.

However, please note that your account configuration needs to match the URLs that you are using so that the invalidations sent to the CDN target the URLs you use. If your account is configured using the default URL format sent for invalidation (option 1 from the list in the link) but you're using no version component for both resources in and without folders in your URLs then these will not be sent for invalidation and therefore you could get cached copies returned after overwriting or deleting resources. This is why it's important for your account configuration to match the URL format you're using.

If you're unsure on your account configuration or have any questions about it specifically, please feel free to open a support ticket - https://support.cloudinary.com/hc/en-us/requests/new - and we'll be able to advise further.

aleksandar-cloudinary avatar Feb 28 '20 12:02 aleksandar-cloudinary

thank you this is very helpful 👍

kangaroo5383 avatar Mar 15 '20 01:03 kangaroo5383