Skip to content

Commit

Permalink
rewrite invalid cloudflare redirect locations
Browse files Browse the repository at this point in the history
After solving a challenge on komikcast.com, cloudflare would redirect to
https:/komikcast.com (with only one '/') when testing on TravisCI.
  • Loading branch information
mikf committed Apr 27, 2019
1 parent 0d7e8be commit 76df628
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gallery_dl/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ def solve_challenge(session, response, kwargs):
log.debug("Headers:\n%s", cf_response.headers)
log.debug("Content:\n%s", cf_response.text)
raise exception.StopExtraction()

if location[0] == "/":
location = root + location
else:
location = re.sub(r"(https?):/(?!/)", r"\1://", location)

for cookie in cf_response.cookies:
if cookie.name == "cf_clearance":
Expand Down

0 comments on commit 76df628

Please sign in to comment.