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

Resolve relative URLs when parsing #32

Closed
aaronpk opened this issue Dec 13, 2014 · 10 comments · Fixed by #68
Closed

Resolve relative URLs when parsing #32

aaronpk opened this issue Dec 13, 2014 · 10 comments · Fixed by #68
Milestone

Comments

@aaronpk
Copy link
Member

aaronpk commented Dec 13, 2014

When parsing a document, all URLs returned should be absolute URLs based off of the URL that is being parsed.

If running Microformats2.parse with a URL as an argument, just use that as the URL to compute relative URLs from. Otherwise, if parsing an HTML string directly, need an additional parameter to pass the URL into.

aaronpk added a commit to aaronpk/webmention.io that referenced this issue Dec 13, 2014
Resolve relative URLs in the parsed data since the Ruby parser doesn't do it for us.

Issue filed there: microformats/microformats-ruby#32
@tantek
Copy link
Member

tantek commented Dec 23, 2014

From the sound of this "If running Microformats2.parse with a URL as an argument, just use that as the URL to compute relative URLs from." that sounds like <base> tags are not taken into account. I believe @barnabywalters has some test cases for that.

@aaronpk
Copy link
Member Author

aaronpk commented Dec 23, 2014

"tags are not taken into account"? I'm not sure I understand

@kylewm
Copy link

kylewm commented Dec 24, 2014

<base> tags perhaps? assuming the tag was stripped from @tantek's post.

@bbauer
Copy link

bbauer commented Jan 8, 2015

@aaronpk @tantek and @kylewm sorry for the delay. Looking into this now...

@veganstraightedge
Copy link
Contributor

Thanks @bbauer!

@tantek
Copy link
Member

tantek commented Aug 21, 2015

Yes, what @kylewm said. Updated my plain text comment to escape the tag that should have "just" been displayed. markdown--

@jeena
Copy link
Collaborator

jeena commented Aug 21, 2015

That would be quite useful for me if this could be fixed too. I haven't seen any other mf2 parser for ruby yet :-/

@veganstraightedge
Copy link
Contributor

@jeena Finally merged your PR. I haven't built and released a new gem yet. But if you could build and test it locally to let me know if your PR fixes your problems, I'd appreciate it.

@veganstraightedge veganstraightedge added this to the Post 3.0 milestone May 13, 2017
dissolve added a commit that referenced this issue May 17, 2017
The error was hit when it encountered href="" and didn't have a base at
all, the resulting absolute url was nil, which was unexpected.

Added a test for the blank href case and added code to get the base from
the url if not provided in the header

Also added a fix to get the base from the url, which may fix #32
 Can someone else confirm this

priority for base detection
1 (highest). base provided during call to .parse()
2. base found from <base> tag in html
3. calculated from url given
@dissolve
Copy link
Collaborator

dissolve commented May 18, 2017

closed accidentally, please confirm this looks good

@dissolve dissolve reopened this May 18, 2017
@dissolve
Copy link
Collaborator

This seems to be pretty well resolved based on some testing i have done.
Please re-open if there are still issues

devstar0826 added a commit to devstar0826/webmention.io that referenced this issue Oct 24, 2019
Resolve relative URLs in the parsed data since the Ruby parser doesn't do it for us.

Issue filed there: microformats/microformats-ruby#32
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

Successfully merging a pull request may close this issue.

7 participants