mirror of
https://github.com/sherlock-project/sherlock
synced 2024-11-22 11:53:03 +00:00
Fix status_code logic bug
This commit is contained in:
parent
da3c90fce8
commit
060088f7a1
2 changed files with 11 additions and 13 deletions
|
@ -1280,7 +1280,7 @@
|
|||
"username_claimed": "blue"
|
||||
},
|
||||
"Minecraft": {
|
||||
"errorCode": [204, 404, 405],
|
||||
"errorCode": 204,
|
||||
"errorType": "status_code",
|
||||
"url": "https://api.mojang.com/users/profiles/minecraft/{}",
|
||||
"urlMain": "https://minecraft.net/",
|
||||
|
@ -1763,7 +1763,7 @@
|
|||
"username_claimed": "blue"
|
||||
},
|
||||
"Slides": {
|
||||
"errorCode": [204, 404],
|
||||
"errorCode": 204,
|
||||
"errorType": "status_code",
|
||||
"url": "https://slides.com/{}",
|
||||
"urlMain": "https://slides.com/",
|
||||
|
|
|
@ -406,19 +406,17 @@ def sherlock(
|
|||
else:
|
||||
query_status = QueryStatus.AVAILABLE
|
||||
elif error_type == "status_code":
|
||||
query_status = QueryStatus.AVAILABLE
|
||||
error_codes = net_info.get("errorCode")
|
||||
query_status = QueryStatus.CLAIMED
|
||||
|
||||
if error_codes: # (if set in data.json)
|
||||
if isinstance(error_codes, int):
|
||||
if error_codes != r.status_code:
|
||||
query_status = QueryStatus.CLAIMED
|
||||
else:
|
||||
if r.status_code not in error_codes:
|
||||
query_status = QueryStatus.CLAIMED
|
||||
# Checks if the status code of the response is 2XX
|
||||
elif not r.status_code >= 300 or r.status_code < 200:
|
||||
query_status = QueryStatus.CLAIMED
|
||||
# Type consistency, allowing for both singlets and lists in manifest
|
||||
if isinstance(error_codes, int):
|
||||
error_codes = [error_codes]
|
||||
|
||||
if r.status_code in error_codes:
|
||||
query_status = QueryStatus.AVAILABLE
|
||||
elif r.status_code >= 300 or r.status_code < 200:
|
||||
query_status = QueryStatus.AVAILABLE
|
||||
elif error_type == "response_url":
|
||||
# For this detection method, we have turned off the redirect.
|
||||
# So, there is no need to check the response URL: it will always
|
||||
|
|
Loading…
Reference in a new issue