Subject: Bug on SftpFileInfo.GetAbsolutePath(string) method
Date: 2011-09-21 15:36:56
From: Hart Fischer
Source: bug-sftpfileinfo-getabsolutepath-string-method
----------------------------------------------------------------------

Hello,

I found a bug on SftpFileInfo.GetAbsolutePath(string) method. This bug is reproducible. This method was supposed to get the absolute path of a file, but instead, it simply appending Sftp.GetCurrentDirectory() to it.

Here is to reproduce it. (Note: _sftp is an Sftp object)

Console.WriteLine(_sftp.GetCurrentDirectory()); // "/toDir"
SftpFileInfoCollection list = (SftpFileInfoCollection)_sftp.ListDirectory("/fromDir");  // retrieving item lists under directory "fromDir"
for (int i = 0; i < list.Count; i++)
{
    SftpFileInfo item = list[i];
    Console.WriteLine(_sftp.GetAbsolutePath(item.Name)); // output is "/toDir/FileA". It should be "/fromDir/FileA"
}


---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index