Skip to content

Commit 615d998

Browse files
fix: writefile with wrong overwite condition
1 parent 5ce7534 commit 615d998

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/TagBites.IO.Ftp/FtpFileSystemOperations.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public IFileLinkInfo WriteFile(FileLink file, Stream stream, bool overwrite)
9595
var mode = overwrite ? FtpRemoteExists.Overwrite : FtpRemoteExists.Skip;
9696

9797
var result = client.UploadStream(stream, file.FullName, mode, true);
98-
if (overwrite && result != FtpStatus.Success)
98+
if (!overwrite && result != FtpStatus.Success)
9999
throw new IOException("Unable to create a new file. File already exists or an unknown error occur during transfer.");
100100
}
101101

@@ -109,7 +109,7 @@ public async Task<IFileLinkInfo> WriteFileAsync(FileLink file, Stream stream, bo
109109
var mode = overwrite ? FtpRemoteExists.Overwrite : FtpRemoteExists.Skip;
110110

111111
var result = await client.UploadStream(stream, file.FullName, mode, true).ConfigureAwait(false);
112-
if (overwrite && result != FtpStatus.Success)
112+
if (!overwrite && result != FtpStatus.Success)
113113
throw new IOException("Unable to create a new file. File already exists or an unknown error occur during transfer.");
114114
}
115115

0 commit comments

Comments
 (0)