diff options
author | Florent Vennetier <florent.vennetier@ovhcloud.com> | 2021-09-27 18:43:42 +0200 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2021-09-29 19:05:14 -0700 |
commit | c15818f1e6f77119b57d2646c291d694cebd2698 (patch) | |
tree | c4e050d045faf9ce0264fb54956a1e7499e2ea13 /swift/common/middleware/s3api/s3request.py | |
parent | 029e57679c639edda87816482685b8f48de67dd9 (diff) | |
download | swift-c15818f1e6f77119b57d2646c291d694cebd2698.tar.gz |
s3api: fix the copy of non-ASCII objects
Trying to copy an object with non-ASCII characters in its name results
in, depending on the pipeline:
- an error code 412 because of a badly urlencoded path
- an error code 500 "TypeError: Expected a WSGI string"
This commit fixes the problem by calling str_to_wsgi on the object name
after it has been urldecoded. We do not need to call this on the
container name because it is supposed to contain only ASCII characters.
Change-Id: If837d4e55735b10a783c85d91f37fbea5e3baf1d
Diffstat (limited to 'swift/common/middleware/s3api/s3request.py')
-rw-r--r-- | swift/common/middleware/s3api/s3request.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/swift/common/middleware/s3api/s3request.py b/swift/common/middleware/s3api/s3request.py index 2d1f7f287..d4c33512d 100644 --- a/swift/common/middleware/s3api/s3request.py +++ b/swift/common/middleware/s3api/s3request.py @@ -910,7 +910,8 @@ class S3Request(swob.Request): headers = swob.HeaderKeyDict() headers.update(self._copy_source_headers()) - src_resp = self.get_response(app, 'HEAD', src_bucket, src_obj, + src_resp = self.get_response(app, 'HEAD', src_bucket, + swob.str_to_wsgi(src_obj), headers=headers, query=query) if src_resp.status_int == 304: # pylint: disable-msg=E1101 raise PreconditionFailed() |