requote the source when doing a COPY
fixes lp bug 857673 also fixes similar bug in post-as-copy code adds test Change-Id: I7a1984506bba28afe2b7ba46998d7306c058fd5c
This commit is contained in:
parent
bb8c4eab41
commit
742897856f
@ -887,8 +887,8 @@ class ObjectController(Controller):
|
|||||||
req.path_info = '/%s/%s/%s' % (self.account_name,
|
req.path_info = '/%s/%s/%s' % (self.account_name,
|
||||||
self.container_name, self.object_name)
|
self.container_name, self.object_name)
|
||||||
req.headers['Content-Length'] = 0
|
req.headers['Content-Length'] = 0
|
||||||
req.headers['X-Copy-From'] = '/%s/%s' % (self.container_name,
|
req.headers['X-Copy-From'] = quote('/%s/%s' % (self.container_name,
|
||||||
self.object_name)
|
self.object_name))
|
||||||
req.headers['X-Fresh-Metadata'] = 'true'
|
req.headers['X-Fresh-Metadata'] = 'true'
|
||||||
resp = self.PUT(req)
|
resp = self.PUT(req)
|
||||||
# Older editions returned 202 Accepted on object POSTs, so we'll
|
# Older editions returned 202 Accepted on object POSTs, so we'll
|
||||||
@ -1228,7 +1228,7 @@ class ObjectController(Controller):
|
|||||||
req.method = 'PUT'
|
req.method = 'PUT'
|
||||||
req.path_info = '/' + self.account_name + dest
|
req.path_info = '/' + self.account_name + dest
|
||||||
req.headers['Content-Length'] = 0
|
req.headers['Content-Length'] = 0
|
||||||
req.headers['X-Copy-From'] = source
|
req.headers['X-Copy-From'] = quote(source)
|
||||||
del req.headers['Destination']
|
del req.headers['Destination']
|
||||||
return self.PUT(req)
|
return self.PUT(req)
|
||||||
|
|
||||||
|
@ -801,9 +801,9 @@ class TestFile(Base):
|
|||||||
env = TestFileEnv
|
env = TestFileEnv
|
||||||
set_up = False
|
set_up = False
|
||||||
|
|
||||||
"""
|
|
||||||
def testCopy(self):
|
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)
|
file = self.env.container.file(source_filename)
|
||||||
|
|
||||||
metadata = {}
|
metadata = {}
|
||||||
@ -811,6 +811,7 @@ class TestFile(Base):
|
|||||||
metadata[Utils.create_name()] = Utils.create_name()
|
metadata[Utils.create_name()] = Utils.create_name()
|
||||||
|
|
||||||
data = file.write_random()
|
data = file.write_random()
|
||||||
|
file.sync_metadata(metadata)
|
||||||
|
|
||||||
dest_cont = self.env.account.container(Utils.create_name())
|
dest_cont = self.env.account.container(Utils.create_name())
|
||||||
self.assert_(dest_cont.create())
|
self.assert_(dest_cont.create())
|
||||||
@ -887,12 +888,6 @@ class TestFile(Base):
|
|||||||
cfg={'destination': Utils.create_name()}))
|
cfg={'destination': Utils.create_name()}))
|
||||||
self.assert_status(412)
|
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):
|
def testCopyFromHeader(self):
|
||||||
source_filename = Utils.create_name()
|
source_filename = Utils.create_name()
|
||||||
file = self.env.container.file(source_filename)
|
file = self.env.container.file(source_filename)
|
||||||
@ -952,7 +947,6 @@ class TestFile(Base):
|
|||||||
hdrs={'X-Copy-From': '%s%s/%s' % (prefix,
|
hdrs={'X-Copy-From': '%s%s/%s' % (prefix,
|
||||||
self.env.container.name, source_filename)})
|
self.env.container.name, source_filename)})
|
||||||
self.assert_status(404)
|
self.assert_status(404)
|
||||||
"""
|
|
||||||
|
|
||||||
def testNameLimit(self):
|
def testNameLimit(self):
|
||||||
limit = 1024
|
limit = 1024
|
||||||
|
Loading…
Reference in New Issue
Block a user