GH-9129: SFTP: Remove extra / for the file_remoteDirectory header
Fixes: #9129 If `.remoteDirectory("/sftpSource")`, then `FileHeaders.REMOTE_DIRECTORY` is `//sftpSource` * Fix `AbstractInboundFileSynchronizer` to not add `/` if one is already present in the beginning of the `remoteDirectoryPath` **Auto-cherry-pick to `6.2.x` & `6.1.x`**
This commit is contained in:
@@ -502,7 +502,10 @@ public abstract class AbstractInboundFileSynchronizer<F>
|
||||
try {
|
||||
String remoteFileMetadata =
|
||||
new URI(protocol(), null, host, Integer.parseInt(port),
|
||||
'/' + remoteDirectoryPath, null, remoteFileName)
|
||||
remoteDirectoryPath.charAt(0) == '/'
|
||||
? remoteDirectoryPath :
|
||||
'/' + remoteDirectoryPath,
|
||||
null, remoteFileName)
|
||||
.toString();
|
||||
this.remoteFileMetadataStore.put(buildMetadataKey(localFile), remoteFileMetadata);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user