alpakka icon indicating copy to clipboard operation
alpakka copied to clipboard

Expose setPreserveAttributes to SftpApi clients

Open avbhandaru opened this issue 2 years ago • 2 comments

Short description

I want a way to setPreserveAttributes(false) when using Alpakka's SftpApi. At the moment, Alpakka SFTP uses sshj's SSHClient and SFTPClient to support secure file transfers. See SftpOperations.scala for how sshj's SFTPClient is instantiated.

Often times, the destination server does not allow the requesting server to preserve file attributes/permissions. In sshj, the SFTPClient exposes a way to avoid file attribute permission errors by allowing you to directly change the SFTPClient's file transfer property.

sftpClient.getFileTransfer.setPreserveAttributes(false)

However, to do the above, I would need to forgo using other aspects of Alpakka's SftpApi that I want and use sshj directly.

Details

I'd like a way to do the above using the SftpSettings case class, which would then be used to set the file transfer preserveAttributes field in SftpOperations.scala.

avbhandaru avatar May 26 '22 08:05 avbhandaru

Additionally, some way for clients to override or set a custom SFTPclient would also suffice, the same way SftpApi has a companion object that has a constructor that accepts a customSshClient: https://github.com/akka/alpakka/blob/33cc6265d37fe2811f00f23fcdf658476b039be6/ftp/src/main/scala/akka/stream/alpakka/ftp/javadsl/FtpApi.scala#L577-L589

avbhandaru avatar May 27 '22 00:05 avbhandaru

I guess allowing for the same approach as in SftpApi gives best flexibility to access the underlying implementation.

ennru avatar May 28 '22 15:05 ennru