FTP client.PutFile() method does not recognize forward-slashes for a local file on Mac

0 votes
asked Sep 24 by zyggyrat (120 points)

I'm calling client.PutFile() as follows:

this.client.PutFile(fileName, remoteFile);

where

 fileName = "./testResources/someFile.txt"

I'm on a Mac, so forward-slashes make sense. However, the call produces the following error:

Error: System.InvalidOperationException: Local item doesn't exist.
at Rebex.IO.LocalItem.dkiut()
at Rebex.IO.LocalItem.get_Length()
at mupjf.nsbcv.fukyt(TransferAction p0, String p1, String p2, Char[] p3)
at Rebex.Net.Sftp.kabfl(TransferAction p0, String p1, String p2)
at Rebex.Net.Sftp.PutFile(String localPath, String remotePath)

If I switch the slashes to back-slashes as follows:

fileName = ".\testResources\someFile.txt"

there's no failure. Is this a bug?

Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Sep 25 by Pavel Matyska (13,440 points)

Hi,

I tried this on MacOS on Mono 6.0.6 and .NET Core 2.1 and forward slashes work for me as expected.

What platform are you running your application? What version of our component are you using? What do you get if you call File.Open(fileName, FileMode.Open) with the fileName with forward-slashes?

commented Sep 25 by zyggyrat (120 points)
Hi Pavel,

Thanks for the quick response!

I'm using the 5.0.7501 version of the Rebex library with .NET Core 3.1 and Mono 6.10.0 Stable (bundled with the latest Visual Studio for Mac). File.Open with forward slashes works perfectly fine. This is part of a cross-platform CLI application that manages ETL activities with about 70% test coverage; we open, write, delete files and manipulate paths with forward-slashes all the time within the codebase, so this was unexpected.

-Stephen
commented Sep 25 by Lukas Pokorny (115,410 points)
Hi Stephen, can you provide a snippet of code that reproduces the issue? Perhaps we were doing something differently.
...