DjangoAdminHackers / django-linkcheck

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

Remove optimization for internal anchors #172

Closed timobrembeck closed 1 year ago

timobrembeck commented 1 year ago

I noticed several problems with the current optimization for relative internal anchors (e.g. #anchor links in the content that are converted to /absolute/internal/url/#anchor):

  1. I forgot to migrate this case to the new usage of check_anchor(), so it raises an exception at the moment
  2. It does not set the new fields for status_code etc...
  3. It is untested
  4. It overrides the builtin hash

Instead of fixing it, I think we can remove this block of code and rely on the following elif self.type == 'internal': to handle this case. Making a request with the test client won't be that much slower than checking the model fields manually I guess.