diff --git a/swift/obj/server.py b/swift/obj/server.py index 408b6416e1..157cca4d93 100644 --- a/swift/obj/server.py +++ b/swift/obj/server.py @@ -686,7 +686,7 @@ class ObjectController(BaseStorageServer): except DiskFileXattrNotSupported: return HTTPInsufficientStorage(drive=device, request=request) except DiskFileDeleted as e: - orig_metadata = e.metadata + orig_metadata = {} orig_timestamp = e.timestamp except (DiskFileNotExist, DiskFileQuarantined): orig_metadata = {} diff --git a/test/functional/test_object.py b/test/functional/test_object.py index f23ccbc78e..f6c82668f2 100644 --- a/test/functional/test_object.py +++ b/test/functional/test_object.py @@ -273,6 +273,12 @@ class TestObject(unittest2.TestCase): }) def test_if_none_match(self): + def delete(url, token, parsed, conn): + conn.request('DELETE', '%s/%s/%s' % ( + parsed.path, self.container, 'if_none_match_test'), '', + {'X-Auth-Token': token}) + return check_response(conn) + def put(url, token, parsed, conn): conn.request('PUT', '%s/%s/%s' % ( parsed.path, self.container, 'if_none_match_test'), '', @@ -287,6 +293,13 @@ class TestObject(unittest2.TestCase): resp.read() self.assertEqual(resp.status, 412) + resp = retry(delete) + resp.read() + self.assertEqual(resp.status, 204) + resp = retry(put) + resp.read() + self.assertEqual(resp.status, 201) + def put(url, token, parsed, conn): conn.request('PUT', '%s/%s/%s' % ( parsed.path, self.container, 'if_none_match_test'), '',