Skip to content

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Dec 18, 2025

Fixes #1498

@st0012 st0012 added the bug label Dec 18, 2025
@matzbot
Copy link
Collaborator

matzbot commented Dec 18, 2025

🚀 Preview deployment available at: https://7fc5f247.rdoc-6cd.pages.dev (commit: ea50b1a)


def resolve_url(rel_prefix, url)
uri = URI.parse(url)
if uri.absolute?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a URI ever not be absolute? I thought parsing a URI for a relative path always failed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you can create URI with a wide range of strings:

irb(main):005> URI.parse("/foo")
=> #<URI::Generic /foo>
irb(main):006> URI("/foo")
=> #<URI::Generic /foo>
irb(main):007> URI("foo")
=> #<URI::Generic foo>
irb(main):008> URI("foo").absolute?
=> false
irb(main):009> URI("/foo").absolute?
=> false
irb(main):010> URI("foobar?baz>").absolute?
=> false

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. I think the limitation is with file URIs.

We use URIs for files so often for tooling stuff I forget there are other URIs 😅


def resolve_url(rel_prefix, url)
uri = URI.parse(url)
if uri.absolute?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. I think the limitation is with file URIs.

We use URIs for files so often for tooling stuff I forget there are other URIs 😅

@st0012 st0012 merged commit 60f3d31 into master Dec 18, 2025
62 checks passed
@st0012 st0012 deleted the fix-1498 branch December 18, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken link in footer

4 participants