From bdccc6b798f7e436c88ad771fc19e4bf6cb36bc5 Mon Sep 17 00:00:00 2001
From: Daniel Speichert <Daniel_Speichert@comcast.com>
Date: Mon, 21 Mar 2022 12:46:37 -0400
Subject: [PATCH] fix: improperly encoded object names

Static Large Object (SLO) manifests do not allow urlencoded
object names.

Related change: Ifbcde7f1c59bee16b4c133c3ff4ff69858c774ce

Change-Id: I5a7a7c50f67d3fbda7e2df2492ccaa8e3c9f0fee
---
 openstack/object_store/v1/_proxy.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/openstack/object_store/v1/_proxy.py b/openstack/object_store/v1/_proxy.py
index 917ec3f88..54a304d85 100644
--- a/openstack/object_store/v1/_proxy.py
+++ b/openstack/object_store/v1/_proxy.py
@@ -591,7 +591,10 @@ class Proxy(proxy.Proxy):
             # TODO(mordred) Collect etags from results to add to this manifest
             # dict. Then sort the list of dicts by path.
             manifest.append(dict(
-                path='/{name}'.format(name=name),
+                # While Object Storage usually expects the name to be
+                # urlencoded in most requests, the SLO manifest requires
+                # plain object names instead.
+                path='/{name}'.format(name=parse.unquote(name)),
                 size_bytes=segment.length))
 
         # Try once and collect failed results to retry
@@ -731,7 +734,9 @@ class Proxy(proxy.Proxy):
                 continue
             name = self._object_name_from_url(result.url)
             for entry in manifest:
-                if entry['path'] == '/{name}'.format(name=name):
+                if entry['path'] == '/{name}'.format(
+                        name=parse.unquote(name)
+                ):
                     entry['etag'] = result.headers['Etag']
 
     def get_info(self):