Fixes a bug where a placeholder is being generated for wrong src assumed to be a Cloudinary image.
How to test this PR?
/*
* Before
* Given an image with src other than Cloudinary
* https://cdn.pexels.com/upload/2012/02/10/cloudinary__340.jpg
*/
if (src && src.includes('cloudinary')) { // matches
...
}
As stated in Cloudinary documentation here, the best way to test if the image is from Cloudinary is to check in the host
/*
* After
* Given an image with src other than Cloudinary
* https://cdn.pexels.com/upload/2012/02/10/cloudinary__340.jpg
*/
try {
const srcURL = new URL(src)
if (srcURL.host.includes('cloudinary')) { // does not match
...
}
} catch(err) {}
What does this PR do?
Fixes a bug where a placeholder is being generated for wrong
src
assumed to be a Cloudinary image.How to test this PR?
As stated in Cloudinary documentation here, the best way to test if the image is from Cloudinary is to check in the host