question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Encoding on encoded url for image

See original GitHub issue

Bug Description

Image url is getting encoded without checking whether the url is already encoded while adding image url in the element.

Note: This may not be a bug for wordpress case

Expected Behaviour

Would be good if we check the url before encoding.

Steps to Reproduce

Used storybook

  1. Use firebase storage image url
  2. Add image url in getDummyMedia list
  3. Go to stories editor and add image from media section to the story card.

For more details please see below video

Sample :

    createDummyImageData({
      mimeType: 'image/jpeg',
      src: 'https://firebasestorage.googleapis.com/v0/b/c-dashboard-d4a82.appspot.com/o/media%2FNurUn5ekSeOkSCfk1yPIkg17buI3%2Fimages%2F1650068451121-omid-armin-nACf6L_pXq8-unsplash.jpeg?alt=media&token=edc4dfd7-6ac1-44a0-83b7-1aa99a3adad3',
      width: 5262,
      height: 7981,
      id: 1,
      title: 'dummy image',
    })

Actual image url :

https://firebasestorage.googleapis.com/v0/b/c-dashboard-d4a82.appspot.com/o/media%2FNurUn5ekSeOkSCfk1yPIkg17buI3%2Fimages%2F1650068451121-omid-armin-nACf6L_pXq8-unsplash.jpeg?alt=media&token=edc4dfd7-6ac1-44a0-83b7-1aa99a3adad3

Encoded srcSet url :

https://firebasestorage.googleapis.com/v0/b/c-dashboard-d4a82.appspot.com/o/media%252FNurUn5ekSeOkSCfk1yPIkg17buI3%252Fimages%252F1650068451121-omid-armin-nACf6L_pXq8-unsplash.jpeg?alt=media&token=edc4dfd7-6ac1-44a0-83b7-1aa99a3adad3 412w

Screenshots

Screen Shot 2022-04-21 at 11 01 29 PM

Video

https://user-images.githubusercontent.com/12577046/164589464-08e291c7-f0b3-4ea8-a918-0ba55045a78c.mov

Additional Context

https://github.com/GoogleForCreators/web-stories-wp/blob/925e8057d693f05c3803740d8634617f2825ce7b/packages/media/src/calculateSrcSet.js#L50

  • Branch : main branch
  • WordPress Version: Not applicable
  • Operating System: mac
  • Browser: chrome

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
swissspidycommented, Apr 22, 2022

Thanks for reporting!

Sounds like we ought to be able to make this more robust.

For context, this was introduced in #9452

0reactions
santoshgisttocommented, Jun 22, 2022

Sorry for late response @swissspidy https://github.com/GoogleForCreators/web-stories-wp/pull/11731 its working thank you 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Base64 Image Encoder - Convert any image file or URL online
With Base64 Image Encoder, you can convert any image file or URL to either Base64, HTML, CSS, JSON, or XML online. Everything happens...
Read more >
Base64 Image Encoder
Optimize your images and convert them to base64 online. Drag & Drop your files, copy to clipboard with a click and use the...
Read more >
Convert image to url encoded base64 - ChemInfo.org
Convert image to url encoded base64. This view allows to quickly generate an URL encoded image. While it may be intersting to insert...
Read more >
How to convert image to Base64 online - Base64.Guru
1. Choose the source of image from the “Datatype” field. 2. Paste the URL or select an image from your computer. 3. If...
Read more >
Data URLs - HTTP - MDN Web Docs - Mozilla
Encoding in JavaScript. The Web APIs have native methods to encode or decode to base64: Base64 encoding and decoding. Encoding on a Unix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found