aaronpk / Telegraph

Telegraph is an API for sending Webmentions
https://telegraph.p3k.io
Apache License 2.0
31 stars 5 forks source link

Can’t find the link in the source document, after already detecting it and showing a button #20

Open Zegnat opened 7 years ago

Zegnat commented 7 years ago

I was trying to send a Webmention from https://licit.li/59997fedcc6ab to https://stream.jeremycherfas.net/2017/ive-been-thinking-about-robs-post-and-your-notes-on. It correctly detects the link, but when I click the “Send Webmention” button it ends up in an endless spinner and the following is returned from https://telegraph.p3k.io/webmention:

{"error":"no_link_found","error_description":"The source document does not have a link to the target URL or domain"}

I would expect the spinner to stop and show an error when Telegraph returns an error to the request, telling me as user that something went wrong.

Though I would also expect it to send this mention as it was able to detect the link prior to me clicking the button.

aaronpk commented 7 years ago

This is actually a different bug, but interesting. Technically your page does not have a link to Jeremy's page, since your source HTML contains

<data class="u-in-reply-to" value="https://stream.jeremycherfas.net/2017/ive-been-thinking-about-robs-post-and-your-notes-on">

Data elements are not web links, so Telegraph's error message is correct.

However when the Microformats parser parses the page it sees the in-reply-to URL as a valid URL.

So the actual bug with Telegraph is that link should never have been included as an option to send to in the first place.

Zegnat commented 7 years ago

Upon reading the Webmention spec again, specifically verification, I agree that my implementation might be wrong. I think Telegraph shouldn’t be using the mf2 parser at all if it only implements Webmention.

Though I think the “other similar links” in “look for <a href="*">, <img href="*">, <video src="*"> and other similar links” might be interpreted as links provided through microformats. The spec links to the HTML5 spec, but the only “links” I can find there is in 4.8:

Links are a conceptual construct, created by a, area, and link elements, […]

So the video and img elements as mentioned in the Webmention spec aren’t considered “links” in HTML5 at all. This makes for a very vague subset of what elements should and should not be supported.

(This might need to be moved to an issue on the Webmention spec.)

aaronpk commented 7 years ago

So turns out the method that finds that initial list of links is in the mention-client-php library. I've filed an issue there accordingly: https://github.com/indieweb/mention-client-php/issues/33