Skip to content

Instantly share code, notes, and snippets.

@bloodeagle40234
Created January 16, 2020 10:44
Show Gist options
  • Save bloodeagle40234/7dd81e1cc663a79014c539c8f3203a91 to your computer and use it in GitHub Desktop.
Save bloodeagle40234/7dd81e1cc663a79014c539c8f3203a91 to your computer and use it in GitHub Desktop.
diff --git a/swift/common/utils.py b/swift/common/utils.py
index af21036d7..a0d8b98a3 100644
--- a/swift/common/utils.py
+++ b/swift/common/utils.py
@@ -1231,7 +1231,7 @@ class Timestamp(object):
compatible for normalized timestamps which do not include an offset.
"""
- def __init__(self, timestamp, offset=0, delta=0):
+ def __init__(self, timestamp, offset=0, delta=0, allow_over_unix=False):
"""
Create a new Timestamp.
@@ -1277,7 +1277,7 @@ class Timestamp(object):
self.timestamp = float(self.raw * PRECISION)
if self.timestamp < 0:
raise ValueError('timestamp cannot be negative')
- if self.timestamp >= 10000000000:
+ if not allow_over_unix and self.timestamp >= 10000000000:
raise ValueError('timestamp too large')
@classmethod
diff --git a/swift/obj/diskfile.py b/swift/obj/diskfile.py
index ed9bac5e6..3ea816d66 100644
--- a/swift/obj/diskfile.py
+++ b/swift/obj/diskfile.py
@@ -2568,7 +2568,8 @@ class BaseDiskFile(object):
raise DiskFileCollision('Client path does not match path '
'stored in object metadata')
try:
- x_delete_at = int(self._metadata['X-Delete-At'])
+ x_delete_at = Timestamp(self._metadata['X-Delete-At'],
+ allow_over_unix=True)
except KeyError:
pass
except ValueError:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment