image icon indicating copy to clipboard operation
image copied to clipboard

Cloudflare does not encode special characters in the URL

Open iBobik opened this issue 6 months ago • 0 comments

<img onerror="this.setAttribute(&#39;data-error&#39;, 1)" data-nuxt-img sizes="100vw" srcset="https://example.com/cdn-cgi/image/f=auto,w=320/images/products/fpv.jpeg 320w, https://example.com/cdn-cgi/image/f=auto,w=640/images/products/fpv.jpeg 640w" class="object-cover sm:w-52 sm:h-48" src="https://example.com/cdn-cgi/image/f=auto,w=640/images/products/fpv.jpeg">

This will call https://example.com/cdn-cgi/image/f=auto and w=320/images/products/fpv.jpeg

Comma in the srcset separates variants, so when URL containing it must be encoded like this:

https://example.com/cdn-cgi/image/f%3Dauto%2Cw%3D320/images/products/fpv.jpeg

iBobik avatar Jun 25 '25 14:06 iBobik