Created
February 22, 2014 04:34
-
-
Save clayg/9148820 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/swift/obj/server.py b/swift/obj/server.py | |
index 4ce53dd..ddca987 100644 | |
--- a/swift/obj/server.py | |
+++ b/swift/obj/server.py | |
@@ -510,8 +510,12 @@ class ObjectController(object): | |
pass | |
response.headers['X-Timestamp'] = file_x_ts | |
resp = request.get_response(response) | |
- except (DiskFileNotExist, DiskFileQuarantined): | |
- resp = HTTPNotFound(request=request, conditional_response=True) | |
+ except (DiskFileNotExist, DiskFileQuarantined) as e: | |
+ headers = {} | |
+ if hasattr(e, 'timestamp'): | |
+ headers['X-Timestamp'] = e.timestamp | |
+ resp = HTTPNotFound(request=request, headers=headers, | |
+ conditional_response=True) | |
return resp | |
@public | |
@@ -527,8 +531,12 @@ class ObjectController(object): | |
return HTTPInsufficientStorage(drive=device, request=request) | |
try: | |
metadata = disk_file.read_metadata() | |
- except (DiskFileNotExist, DiskFileQuarantined): | |
- return HTTPNotFound(request=request, conditional_response=True) | |
+ except (DiskFileNotExist, DiskFileQuarantined) as e: | |
+ headers = {} | |
+ if hasattr(e, 'timestamp'): | |
+ headers['X-Timestamp'] = e.timestamp | |
+ return HTTPNotFound(request=request, headers=headers, | |
+ conditional_response=True) | |
response = Response(request=request, conditional_response=True) | |
response.headers['Content-Type'] = metadata.get( | |
'Content-Type', 'application/octet-stream') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment