mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
Fixes #750 Fixes #751 Co-authored-by: Jeroen van Erp <jeroen@hierynomus.com>
This commit is contained in:
@@ -235,14 +235,17 @@ public class SFTPEngine
|
|||||||
if (operativeVersion < 1)
|
if (operativeVersion < 1)
|
||||||
throw new SFTPException("RENAME is not supported in SFTPv" + operativeVersion);
|
throw new SFTPException("RENAME is not supported in SFTPv" + operativeVersion);
|
||||||
|
|
||||||
long renameFlagMask = 0L;
|
final Request request = newRequest(PacketType.RENAME).putString(oldPath, sub.getRemoteCharset()).putString(newPath, sub.getRemoteCharset());
|
||||||
for (RenameFlags flag : flags) {
|
// SFTP Version 5 introduced rename flags according to Section 6.5 of the specification
|
||||||
renameFlagMask = renameFlagMask | flag.longValue();
|
if (operativeVersion >= 5) {
|
||||||
|
long renameFlagMask = 0L;
|
||||||
|
for (RenameFlags flag : flags) {
|
||||||
|
renameFlagMask = renameFlagMask | flag.longValue();
|
||||||
|
}
|
||||||
|
request.putUInt32(renameFlagMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
doRequest(
|
doRequest(request).ensureStatusPacketIsOK();
|
||||||
newRequest(PacketType.RENAME).putString(oldPath, sub.getRemoteCharset()).putString(newPath, sub.getRemoteCharset()).putUInt32(renameFlagMask)
|
|
||||||
).ensureStatusPacketIsOK();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String canonicalize(String path)
|
public String canonicalize(String path)
|
||||||
|
|||||||
Reference in New Issue
Block a user