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

Relative URL isn't appearing in mastodon #390

Closed
aciccarello opened this issue Jan 28, 2023 · 7 comments
Closed

Relative URL isn't appearing in mastodon #390

aciccarello opened this issue Jan 28, 2023 · 7 comments
Labels

Comments

@aciccarello
Copy link

aciccarello commented Jan 28, 2023

I posted a note with a relative URL linking to another page on my site.

<div class="post-content mdc-typography--body1 e-content">
  <p>
    I added a new page to my site this week. You can now preview some of the posts I have 
    in progress on the <a href="/drafts">/drafts</a> page!
  </p>
  <p>Beware, I don’t plan on redirecting those old URLs though so I don’t recommend linking to draft posts.</p>
</div>

However, when this appeared in Mastodon the link was removed. (url for logged in user)
screenshot of mastodon web client showing note text with no link.

Could bridgy fed convert the relative path to absolute before sending?

@snarfed
Copy link
Owner

snarfed commented Jan 28, 2023

Yes! Ideally it should. We'll see how easy it is in practice...

@snarfed
Copy link
Owner

snarfed commented Jan 30, 2023

This isn't looking easy, at least with the tools I have. mf2py fully qualifies URLs it hoists out of content, eg in mf2 properties and rel URLs, but not inside <a> tags in HTML e-content. BeautifulSoup doesn't either. So I'd need to do it myself, or find a new tool to do it. Ugh.

Interestingly, php-mf2 does fully qualify link URLs inside HTML content, eg the avoid it altogether link in https://pin13.net/mf2/?url=https://snarfed.org/2023-01-11_logs-as-end-user-ui . Hmm! That sure would be a nice mf2py feature. cc @sknebel @angelogladding @tommorris @barnabywalters @gRegorLove @aaronpk

@barnabywalters
Copy link

IIRC we implemented this in php-mf2 because it was easy, useful and IMO implied by the mf2 parsing algorithm requiring any other relative URLs to be resolved. Embedded content is presumably going to be reused out of context, and it’s not particularly useful if it contains URLs which were relative to some other context! I agree with Zegnat’s proposal that it get explicitly added to the parsing spec. I’m surprised it hasn’t come up in tests already, to be honest.

@snarfed snarfed added the blocked label Feb 1, 2023
@aciccarello
Copy link
Author

aciccarello commented Mar 15, 2023

I haven't tested it yet but I think this could also affect #45 in that hashtag URLs need to be absolute to be recognized by Mastodon.

@snarfed snarfed changed the title Relative URL isn't appearing in mastodon Jun 18, 2023
@snarfed
Copy link
Owner

snarfed commented Nov 15, 2023

Sounds like we might get this in mf2py soon! microformats/mf2py#197 (comment)

@snarfed
Copy link
Owner

snarfed commented Dec 8, 2023

This shipped just now in v2.0.1!

@snarfed snarfed changed the title Relative URL isn't appearing in mastodon (blocked on mf2[py]) Dec 8, 2023
@snarfed snarfed closed this as completed in 79af59b Dec 8, 2023
@aciccarello
Copy link
Author

Just re-sent the mention for the original post and I can now see the URL correctly in Mastodon. 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants