mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix bug in uri where redirect check fails.
When the redirect check fails, the 'status' key is not set in resp_redir, so we need to check this.
This commit is contained in:
parent
39fe40bb60
commit
a311ee35b3
1 changed files with 1 additions and 1 deletions
|
@ -261,7 +261,7 @@ def uri(module, url, dest, user, password, body, method, headers, redirects, soc
|
||||||
# and update dest with the new url filename
|
# and update dest with the new url filename
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if resp_redir['status'] in ["301", "302", "303", "307"]:
|
if 'status' in resp_redir and resp_redir['status'] in ["301", "302", "303", "307"]:
|
||||||
url = resp_redir['location']
|
url = resp_redir['location']
|
||||||
redirected = True
|
redirected = True
|
||||||
dest = os.path.join(dest, url_filename(url))
|
dest = os.path.join(dest, url_filename(url))
|
||||||
|
|
Loading…
Reference in a new issue