Closed Fristi closed 2 years ago
Not sure it is related to file permissions.
Can you copy paste the code your are using to call the upload method .
What is the source
of data your are uploading ?
It turns out it's an fs2 stream converted to a zio stream. Converted that code to see if it helps
Also checked our old code, which used fs2 to create sftp client. Same underlying sshj lib:
def write(filename: String): Pipe[F, Byte, Unit] =
stream =>
fs2.Stream
.resource(remoteFile(sftpClient, filename, NonEmptyList.of(OpenMode.WRITE, OpenMode.CREAT, OpenMode.TRUNC)))
.flatMap(file => io.writeOutputStream[F](Async[F].delay(new file.RemoteFileOutputStream), closeAfterUse = true).apply(limitChunkSize(stream)))
def remoteFile[F[_]: Async](sftpClient: SFTPClient, filename: String, modes: NonEmptyList[OpenMode]): Resource[F, RemoteFile] =
Resource.fromAutoCloseable {
Async[F].delay(sftpClient.open(filename, java.util.EnumSet.of(modes.head, modes.tail: _*)))
}
We use different flags here and we don't override the RemoteFile
.
I think it has to do with the fs2 stream conversion, will get back on that
Issue was in the conversion from a fs2 stream to a zio stream. I've converted cormorant fs2 to a zio kantan.csv version and that works 🎉
Closing this, but leaving #251 open
On ZIO 1
Should not be overwrite, since our filename is based on a time stamp