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

Don't treat some HTTP status error codes as not errors #78

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions htmlproofer/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,10 @@ def contains_anchor(markdown: str, anchor: str) -> bool:
def bad_url(url_status: int) -> bool:
if url_status == -1:
return True
elif url_status == 401 or url_status == 403:
return False
elif url_status in (503, 504):
# Usually transient
return False
elif url_status == 999:
# Returned by some websites (e.g. LinkedIn) that think you're crawling them.
return False
elif url_status >= 400:
return True
return False
else:
return False

@staticmethod
def is_error(config: Config, url: str, url_status: int) -> bool:
Expand Down
Loading