Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static badge with data url logo doesn't work on GitHub if set as srcset attribute of <source> tag #10176

Closed
rindeal opened this issue May 18, 2024 · 6 comments
Labels
question Support questions, usage questions, unconfirmed bugs, discussions, ideas

Comments

@rindeal
Copy link

rindeal commented May 18, 2024

Are you experiencing an issue with...

shields.io

🐞 Description

Setting static badge inside srcset of <source> doesn't work:

/>

If set as src in <img>, it does work:


Screenshot:

Screenshot

🔗 Link to the badge

https://img.shields.io/badge/Open%20Hub-white.svg?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOSAxMyI+PHRleHQgeT0iMTIiIGZpbGw9IiM1YTJhODEiIGZvbnQtZmFtaWx5PSJOaW1idXMgU2FucyBOYXJyb3ciIGZvbnQtd2VpZ2h0PSI4MDAiPk9IPC90ZXh0Pjwvc3ZnPg==

💡 Possible Solution

No response

@rindeal rindeal added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label May 18, 2024
Copy link
Contributor

Badge tested using npm run badge https://img.shields.io/badge/Open%20Hub-white.svg?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOSAxMyI+PHRleHQgeT0iMTIiIGZpbGw9IiM1YTJhODEiIGZvbnQtZmFtaWx5PSJOaW1idXMgU2FucyBOYXJyb3ciIGZvbnQtd2VpZ2h0PSI4MDAiPk9IPC90ZXh0Pjwvc3ZnPg==
Output is available here

@chris48s
Copy link
Member

This is true in a GitHub issue, but if you put

<picture>
  <source srcset="https://img.shields.io/badge/Open%20Hub-white.svg?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOSAxMyI+PHRleHQgeT0iMTIiIGZpbGw9IiM1YTJhODEiIGZvbnQtZmFtaWx5PSJOaW1idXMgU2FucyBOYXJyb3ciIGZvbnQtd2VpZ2h0PSI4MDAiPk9IPC90ZXh0Pjwvc3ZnPg==" />
  <img />
</picture>

in a HTML file it works as expected.

If you look at what GitHub is actually rendering in those two cases, it is

<source srcset="..." data-canonical-src="https://img.shields.io/badge/Open%20Hub-white.svg?logo=data:image/svg%2bxml;base64">

and

<img src="..." data-canonical-src="https://img.shields.io/badge/Open%20Hub-white.svg?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOSAxMyI+PHRleHQgeT0iMTIiIGZpbGw9IiM1YTJhODEiIGZvbnQtZmFtaWx5PSJOaW1idXMgU2FucyBOYXJyb3ciIGZvbnQtd2VpZ2h0PSI4MDAiPk9IPC90ZXh0Pjwvc3ZnPg==">

so there is something stripping the part after the comma in the first case, but it is not us.

This isn't something we can do anything about.

@rindeal
Copy link
Author

rindeal commented May 18, 2024

Thanks, I've created a ticket with GitHub. We shall see.

@rindeal
Copy link
Author

rindeal commented May 22, 2024

GitHub support guy confirmed it and sent it to engineering.

@chris48s
Copy link
Member

OK. Cheers for following up. If it has been acknowledged as a problem on GitHub's side, I think we can close this one here.

@chris48s chris48s closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
@rindeal
Copy link
Author

rindeal commented May 22, 2024

Yep, and for posterity, here's a minimal PoC:

echo '<picture><img src="Foo,Bar" /></picture>' | curl -s -L -X POST --data-binary @- --header "Content-Type:text/x-markdown" https://api.github.com/markdown/raw | grep -o 'src="[^"]*"'

src="Foo,Bar"echo '<picture><source srcset="Foo,Bar"> /><img /></picture>' | curl -s -L -X POST --data-binary @- --header "Content-Type:text/x-markdown" https://api.github.com/markdown/raw | grep -o 'srcset="[^"]*"'

srcset="Foo"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Support questions, usage questions, unconfirmed bugs, discussions, ideas
Projects
None yet
Development

No branches or pull requests

2 participants