You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use the FtpHelper to deploy my build output to my web server. But the FtpHelper seems to be broken. I tried to use the function FtpHelper.uploadAFolder which did only work when I uploaded the folder into the root directory or the one level below (/subdirectory).
I received the following error message:
System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (550)
Datei nicht verfügbar (z.B. nicht gefunden oder kein Zugriff).
I tracked the problem down to the method FtpHelper.isFolderPresent which is returning false even tough the folder exists on the server.
// returns false even tough the folder exists
FtpHelper.isFolderPresent server username pwd "/upload/myfolder"
Repro steps
FtpHelper.createAFolder server username pwd "/upload"
FtpHelper.createAFolder server username pwd "/upload/mysubdir"
sprintf "/upload/mysubdir exists: %b"(FtpHelper.isFolderPresent server username pwd "/upload/mysubdir")|> trace
Output:
Creating folder /upload
Getting FTP dir contents for
Create folder status: 257 "//upload" directory created.
Creating folder /upload/mysubdir
Getting FTP dir contents for
Create folder status: 257 "//upload/mysubdir" directory created.
Getting FTP dir contents for
/upload/mysubdir exists: false
Expected behavior
// should return true because the folder exists
FtpHelper.isFolderPresent server username pwd "/upload/mysubdir"
Actual behavior
// returns false but the folder exists
FtpHelper.isFolderPresent server username pwd "/upload/mysubdir"
Known workarounds
I copied the following code into my F# script:
let inlineregexCheck fname ftpContents = Regex.IsMatch(ftpContents,(sprintf @"\s+%s\s+" fname))let inlineprivatelastSlashPos(str :string)= str.LastIndexOf(@"\")+1let inlineprivategetSubstring(fromPos :int)(str :string)(toPos :int)= str.Substring(fromPos, toPos)letprivatecheckInExistingDirList server user pwd destPath fname =
destPath
|> lastSlashPos
|> getSubstring 0 destPath
|> getFtpDirContents server user pwd
|> regexCheck fname
letisFolderPresent server user pwd (destPath :string)=
destPath
|> lastSlashPos
|> destPath.Substring
|> checkInExistingDirList server user pwd destPath
After replacing the backslash with a slash the following line, the isFolderPresent function worked.
In the original code this function returns the position of the last backslash instead of the position of the last slash.
let inlineprivatelastSlashPos(str :string)= str.LastIndexOf(@"/")+1
Related information
Ftp Server:
Windows 2012 Server
IIS 8.0
.Net 4.6
Client:
Windows 7
The text was updated successfully, but these errors were encountered:
Description
I want to use the FtpHelper to deploy my build output to my web server. But the FtpHelper seems to be broken. I tried to use the function
FtpHelper.uploadAFolder
which did only work when I uploaded the folder into the root directory or the one level below (/subdirectory
).I received the following error message:
I tracked the problem down to the method FtpHelper.isFolderPresent which is returning false even tough the folder exists on the server.
Repro steps
Output:
Expected behavior
Actual behavior
Known workarounds
I copied the following code into my F# script:
After replacing the backslash with a slash the following line, the isFolderPresent function worked.
In the original code this function returns the position of the last backslash instead of the position of the last slash.
Related information
Ftp Server:
Client:
The text was updated successfully, but these errors were encountered: