From 6bfd93d88644f0a7ff979dc9d6c3d85fff42f632 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 20 May 2021 15:32:50 -0700 Subject: [PATCH] symlink: Ensure headers are returned as a list on py3 Change-Id: Ic2f4487b6caf81fef3455ce03dda2cc144ae24ec Related-Bug: #1929083 Co-Authored-By: Walter Doekes --- swift/common/middleware/symlink.py | 2 +- test/unit/common/middleware/test_symlink.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/swift/common/middleware/symlink.py b/swift/common/middleware/symlink.py index bde163aa0a..2aac5d1ebc 100644 --- a/swift/common/middleware/symlink.py +++ b/swift/common/middleware/symlink.py @@ -422,7 +422,7 @@ class SymlinkObjectContext(WSGIContext): resp = self._app_call(req.environ) response_header_dict = HeaderKeyDict(self._response_headers) symlink_sysmeta_to_usermeta(response_header_dict) - self._response_headers = response_header_dict.items() + self._response_headers = list(response_header_dict.items()) return resp def handle_get_head(self, req): diff --git a/test/unit/common/middleware/test_symlink.py b/test/unit/common/middleware/test_symlink.py index c8d6b82ce7..3687305bf7 100644 --- a/test/unit/common/middleware/test_symlink.py +++ b/test/unit/common/middleware/test_symlink.py @@ -403,6 +403,7 @@ class TestSymlinkMiddleware(TestSymlinkMiddlewareBase): req = Request.blank('/v1/a/c/symlink?symlink=get', method='GET') status, headers, body = self.call_sym(req) self.assertEqual(status, '200 OK') + self.assertIsInstance(headers, list) self.assertIn(('X-Symlink-Target', 'c1/o'), headers) self.assertNotIn('X-Symlink-Target-Account', dict(headers))