beatonma / django-wm

Automatic Webmention functionality for Django models
https://beatonma.org/webmentions_tester/
GNU General Public License v3.0
12 stars 2 forks source link

Still trying to send webmentions to #anchor links? #38

Closed philgyford closed 1 year ago

philgyford commented 1 year ago

Sorry, me again. I've found a couple of issues, which I don't think are related, so making two issues for them.

First, running ./manage.py pending_mentions manually I end up with a lot of lines like this:

The target URL could not be retrieved: Invalid URL '#s3': No scheme supplied. Perhaps you meant http://#s3?.
The target URL could not be retrieved: Invalid URL '#s8': No scheme supplied. Perhaps you meant http://#s8?.
The target URL could not be retrieved: Invalid URL '#s5': No scheme supplied. Perhaps you meant http://#s5?.
The target URL could not be retrieved: Invalid URL '#s9': No scheme supplied. Perhaps you meant http://#s9?.
The target URL could not be retrieved: Invalid URL '#s8': No scheme supplied. Perhaps you meant http://#s8?.
The target URL could not be retrieved: Invalid URL '#s8': No scheme supplied. Perhaps you meant http://#s8?.
The target URL could not be retrieved: Invalid URL '#s3': No scheme supplied. Perhaps you meant http://#s3?.

I had to stop it eventually, after 550 similar lines. It looks like it's still trying to send webmentions to #anchor links? My pages have a few of these in, e.g. the § markers on https://www.gyford.com/phil/writing/2022/05/15/weeknotes/

beatonma commented 1 year ago

This should now be fixed in 3.1.0.

Link validation has been improved generally[1], and links are now validated while parsing them in the first place, and again during the pending_mentions command. (They shouldn't reach the latter unless validation rules are changed again between version updates, but they will now be caught if they do)

You may see a bunch of Target URL is invalid {url} the next time you run the command but they will be deleted at that point so once they're gone you shouldn't see them again.

[1] On that note, relative links (<a href="/relative/path/">...") can now be resolved as webmention targets.

philgyford commented 1 year ago

Once again, thank you so much for your work on fixing up these annoying edge cases. I really appreciate it.

I realised that I still had over 30,000 pending webmentions, mostly invalid, from an earlier issue, which is why it was taking so long to get through them all. So I deleted the majority of them in the shell, ran pending_mentions, and everything is back as it should be. Incoming and outgoing mentions seem to work just fine.

beatonma commented 1 year ago

Great, glad to hear it!

I love the idea of webmentions and the version of the internet that they enable, but I very rarely write any sort of content to make use of them. Thanks again for actually using them and finding all these edge cases for me :P