An app that will analyze and report on links in any model that you register with it. Links can be bare (urls or image and file fields) or embedded in HTML (linkcheck handles the parsing). It's fairly easy to override methods of the Linkcheck object should you need to do anything more complicated (like generate URLs from slug fields etc).
BSD 3-Clause "New" or "Revised" License
75
stars
26
forks
source link
Incorrect message when redirect has broken anchor #128
When an external link is a redirect and contains a broken hash anchor at the same time, the status is False, but the message still says 301 Moved Permanently or 302 Found which is misleading because it looks like it could not follow the redirect, but instead it could and just reported the link as broken because of the broken anchor.
$ django-admin shell
Python 3.9.15 (main, Oct 23 2022, 17:21:17)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.6.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from linkcheck.models import *
In [2]: url, _ = Url.objects.get_or_create(url="http://httpstat.us/302/#broken-anchor")
In [3]: url.check_url()
Nov 20 10:58:18 INFO linkcheck - checking external link: http://httpstat.us/302/#broken-anchor
Out[3]: False
In [4]: url.message
Out[4]: '302 Found'
When an external link is a redirect and contains a broken hash anchor at the same time, the status is
False
, but the message still says301 Moved Permanently
or302 Found
which is misleading because it looks like it could not follow the redirect, but instead it could and just reported the link as broken because of the broken anchor.To reproduce this, see e.g. he link: http://httpstat.us/302/#broken-anchor