mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #2298 from junegunn/get_url-force
get_url: should always download the file when force is set
This commit is contained in:
commit
a225058457
1 changed files with 1 additions and 1 deletions
|
@ -132,7 +132,7 @@ def url_do_get(module, url, dest):
|
||||||
request = urllib2.Request(url)
|
request = urllib2.Request(url)
|
||||||
request.add_header('User-agent', USERAGENT)
|
request.add_header('User-agent', USERAGENT)
|
||||||
|
|
||||||
if os.path.exists(dest):
|
if os.path.exists(dest) and not module.params['force']:
|
||||||
t = datetime.datetime.utcfromtimestamp(os.path.getmtime(dest))
|
t = datetime.datetime.utcfromtimestamp(os.path.getmtime(dest))
|
||||||
tstamp = t.strftime('%a, %d %b %Y %H:%M:%S +0000')
|
tstamp = t.strftime('%a, %d %b %Y %H:%M:%S +0000')
|
||||||
request.add_header('If-Modified-Since', tstamp)
|
request.add_header('If-Modified-Since', tstamp)
|
||||||
|
|
Loading…
Reference in a new issue