SFTP: fix problem with posix-rename code returning a Deferred for the renamed filenode, not for the result of the request (an empty string).
This commit is contained in:
parent
210578da63
commit
8f86490d48
|
@ -93,7 +93,7 @@ def _convert_error(res, request):
|
|||
logmsg("RAISE %r %r" % (request, err.value), level=OPERATIONAL)
|
||||
try:
|
||||
if noisy: logmsg(traceback.format_exc(err.value), level=NOISY)
|
||||
except:
|
||||
except: # pragma: no cover
|
||||
pass
|
||||
|
||||
# The message argument to SFTPError must not reveal information that
|
||||
|
@ -1398,7 +1398,9 @@ class SFTPUserHandler(ConchUser, PrefixingLogMixin):
|
|||
|
||||
fromPathstring = extensionData[4:(4 + fromPathLen)]
|
||||
toPathstring = extensionData[(8 + fromPathLen):]
|
||||
return self.renameFile(fromPathstring, toPathstring, overwrite=True)
|
||||
d = self.renameFile(fromPathstring, toPathstring, overwrite=True)
|
||||
d.addCallback(lambda ign: "")
|
||||
return d
|
||||
|
||||
if extensionName == 'statvfs@openssh.com' or extensionName == 'fstatvfs@openssh.com':
|
||||
return defer.succeed(struct.pack('>11Q',
|
||||
|
|
|
@ -1009,7 +1009,9 @@ class Handler(GridTestMixin, ShouldFailMixin, unittest.TestCase):
|
|||
def _renameFile(fromPathstring, toPathstring):
|
||||
extData = (struct.pack('>L', len(fromPathstring)) + fromPathstring +
|
||||
struct.pack('>L', len(toPathstring)) + toPathstring)
|
||||
return self.handler.extendedRequest('posix-rename@openssh.com', extData)
|
||||
d2 = self.handler.extendedRequest('posix-rename@openssh.com', extData)
|
||||
d2.addCallback(lambda res: self.failUnlessReallyEqual(res, ""))
|
||||
return d2
|
||||
|
||||
d = self._set_up("renameFile_posix")
|
||||
d.addCallback(lambda ign: self._set_up_tree())
|
||||
|
|
Loading…
Reference in New Issue