Skip to content

Images with a colon in URL are broken #1357

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

Closed
alexisbernard opened this issue May 3, 2025 · 3 comments
Closed

Images with a colon in URL are broken #1357

alexisbernard opened this issue May 3, 2025 · 3 comments

Comments

@alexisbernard
Copy link
Contributor

Hi,

RDoc uses : to split URL and alt text since #1320. But a lot of badges in READMES have a colon in the URL: https://img.shields.io/gem/v/tzinfo?logo=rubygems&label=Gem:RubyGems. So it outputs: <img src="https:", alt="//img.shields.io/gem/v/tzinfo?logo=rubygems&label=Gem:RubyGems"/>. The colon is also authorized in some file systems such as ext4.

It would be better to switch to a character illegal in URLs such as | which have to be encoded. But I could not find a reference of RDoc format explaining the alt text. The newest I found is https://docs.ruby-lang.org/en/3.1/RDoc/Markup.html#class-RDoc::Markup-label-Links but there is no mention of alt text.

@kou
Copy link
Member

kou commented May 3, 2025

Does #1348 solve this?

@alexisbernard
Copy link
Contributor Author

Probably not:

url, alt = "https://img.shields.io/gem/v/tzinfo?logo=rubygems&label=Gem:RubyGems".split(/:(?!\/)/, 2)
=> ["https://img.shields.io/gem/v/tzinfo?logo=rubygems&label=Gem", "RubyGems"]

Sorry, I cannot test properly against master because of a loading error that I have to dig.

@alexisbernard
Copy link
Contributor Author

I was wrong in my last comment. It's solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants