simply-static icon indicating copy to clipboard operation
simply-static copied to clipboard

Replacing URLs within srcset attributes produces duplicate "https" prefix

Open patrickposner opened this issue 1 year ago • 6 comments

Detailed description here: https://wordpress.org/support/topic/current-page-url-https-is-added-to-background-image-url-breaking-it/

Screenshot 2024-05-05 at 14 38 02

patrickposner avatar May 05 '24 12:05 patrickposner

@patrickposner this seems to be happening only when using an image background on the "Group" block.

"Cover", "Media & Text" and "Image" blocks, I get no issues.

pedddro avatar Jul 02 '24 17:07 pedddro

@pedddro I couldn't reproduce it.

Do you know maybe if the original image has the site URL or something like that in it's name? So it gets replaced twice as the regex finds it there already?

Or is the page itself a paginated one? Could you copy the HTML of that page here so I can run tests through that HTML?

igorbenic avatar Jul 23 '24 18:07 igorbenic

@igorbenic steps to reproduce is just add a background image to any "Group" block. Other blocks, simply static seem to render correctly.

Here's a repro: https://poetic-beignet-545238.netlify.app/reproduce-simply-static-error/ Using cloudflare: https://simply-static-error.pages.dev/reproduce-simply-static-error/

pedddro avatar Jul 23 '24 19:07 pedddro

@pedddro Couldn't reproduce it with the group block.

Mine got replaced correctly:

Relative: Screenshot 2024-07-23 at 19 51 34

Absolute: Screenshot 2024-07-23 at 21 43 55

Would need if possible: original HTML that you can get from the editor by using the "Code Editor" instead of Visual Editor:

Screenshot 2024-07-23 at 21 44 58 Screenshot 2024-07-23 at 21 45 12

And also the general settings regarding URLs: Screenshot 2024-07-23 at 21 46 27

I can then try running that locally and see if I can reproduce the same error and find out what could be causing it.

igorbenic avatar Jul 23 '24 19:07 igorbenic

@igorbenic https://gist.github.com/pedddro/5d721ebf64c4f0b9b34b154a4dcd0931

pedddro avatar Jul 23 '24 20:07 pedddro

I managed to fix it manually by deleting the extra https:// + (the page's URL) that is added to the background image URL css

pedddro avatar Aug 07 '24 16:08 pedddro

I'm gonna close this for now.

patrickposner avatar Jan 23 '25 03:01 patrickposner