From a311ee35b37520cc879eb6f50046861f3f162328 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Thu, 29 Aug 2013 15:29:14 +0200 Subject: [PATCH] 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. --- library/network/uri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/network/uri b/library/network/uri index a58c49d0e6a..3d05db22810 100644 --- a/library/network/uri +++ b/library/network/uri @@ -261,7 +261,7 @@ def uri(module, url, dest, user, password, body, method, headers, redirects, soc # and update dest with the new url filename except: 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'] redirected = True dest = os.path.join(dest, url_filename(url))