diff --git a/swift/proxy/server.py b/swift/proxy/server.py index 84f460af4f..513576f6df 100644 --- a/swift/proxy/server.py +++ b/swift/proxy/server.py @@ -887,8 +887,8 @@ class ObjectController(Controller): req.path_info = '/%s/%s/%s' % (self.account_name, self.container_name, self.object_name) req.headers['Content-Length'] = 0 - req.headers['X-Copy-From'] = '/%s/%s' % (self.container_name, - self.object_name) + req.headers['X-Copy-From'] = quote('/%s/%s' % (self.container_name, + self.object_name)) req.headers['X-Fresh-Metadata'] = 'true' resp = self.PUT(req) # Older editions returned 202 Accepted on object POSTs, so we'll @@ -1228,7 +1228,7 @@ class ObjectController(Controller): req.method = 'PUT' req.path_info = '/' + self.account_name + dest req.headers['Content-Length'] = 0 - req.headers['X-Copy-From'] = source + req.headers['X-Copy-From'] = quote(source) del req.headers['Destination'] return self.PUT(req) diff --git a/test/functional/tests.py b/test/functional/tests.py index 3decacd4e2..4490dcf01b 100644 --- a/test/functional/tests.py +++ b/test/functional/tests.py @@ -801,9 +801,9 @@ class TestFile(Base): env = TestFileEnv set_up = False - """ def testCopy(self): - source_filename = Utils.create_name() + # makes sure to test encoded characters" + source_filename = 'dealde%2Fl04 011e%204c8df/flash.png' file = self.env.container.file(source_filename) metadata = {} @@ -811,6 +811,7 @@ class TestFile(Base): metadata[Utils.create_name()] = Utils.create_name() data = file.write_random() + file.sync_metadata(metadata) dest_cont = self.env.account.container(Utils.create_name()) self.assert_(dest_cont.create()) @@ -887,12 +888,6 @@ class TestFile(Base): cfg={'destination': Utils.create_name()})) self.assert_status(412) - # extra slash - self.assert_(not file.copy(Utils.create_name(), Utils.create_name(), - cfg={'destination': '/%s/%s/%s' % (Utils.create_name(), - Utils.create_name(), Utils.create_name())})) - self.assert_status(412) - def testCopyFromHeader(self): source_filename = Utils.create_name() file = self.env.container.file(source_filename) @@ -952,7 +947,6 @@ class TestFile(Base): hdrs={'X-Copy-From': '%s%s/%s' % (prefix, self.env.container.name, source_filename)}) self.assert_status(404) - """ def testNameLimit(self): limit = 1024