summaryrefslogtreecommitdiff
path: root/swiftclient/service.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2016-01-29 16:50:15 -0800
committerTim Burke <tim.burke@gmail.com>2016-01-29 16:50:15 -0800
commit337570a03a57b2bceb615c4fe99ccaa18e0220c9 (patch)
tree265a58d3cc3a613e1fd6708017b8d10ef8339699 /swiftclient/service.py
parent6f431ee0653a4c7030b2d66f673bc9374e10896d (diff)
downloadpython-swiftclient-337570a03a57b2bceb615c4fe99ccaa18e0220c9.tar.gz
Don't trust X-Object-Meta-Mtime
Still use it if we can, but stop throwing ValueErrors if it's garbage. Change-Id: I2cf25b535ad62cfacb7561954a92a4a73d91000a
Diffstat (limited to 'swiftclient/service.py')
-rw-r--r--swiftclient/service.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py
index 492055d..20c023b 100644
--- a/swiftclient/service.py
+++ b/swiftclient/service.py
@@ -1162,11 +1162,15 @@ class SwiftService(object):
if fp is not None:
fp.close()
if 'x-object-meta-mtime' in headers and not no_file:
- mtime = float(headers['x-object-meta-mtime'])
- if options['out_file']:
- utime(options['out_file'], (mtime, mtime))
+ try:
+ mtime = float(headers['x-object-meta-mtime'])
+ except ValueError:
+ pass # no real harm; couldn't trust it anyway
else:
- utime(path, (mtime, mtime))
+ if options['out_file']:
+ utime(options['out_file'], (mtime, mtime))
+ else:
+ utime(path, (mtime, mtime))
res = {
'action': 'download_object',