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
Build script fails to create remote "Content" folder when uploading compiled web-site over to FTP, using FtpHelper.uploadAFolder method.
Repro steps
Create a script that uploads a web-site to FTP server.
Make sure your web-site contains folder named "Content".
Run script.
Expected behavior
Web-site uploaded successfully to remote FTP server.
Actual behavior
Script fails with the exception:
System.ArgumentException: parsing "\s+wwwroot1\Content\s+" - Unrecognized escape sequence \C.
at System.Text.RegularExpressions.RegexParser.ScanCharEscape()
at System.Text.RegularExpressions.RegexParser.ScanBasicBackslash()
at System.Text.RegularExpressions.RegexParser.ScanBackslash()
at System.Text.RegularExpressions.RegexParser.ScanRegex()
at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)
at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
at Fake.FtpHelper.checkInExistingDirList(String server, String user, String pwd, String destPath, String fname) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 90
at Fake.FtpHelper.createAFolder(String server, String user, String pwd, String destPath) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 116
at Fake.FtpHelper.upload(String server, String user, String pwd, FileSystemInfo fsi, String rootDir) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 140
at [email protected](FileSystemInfo fsi) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 134
at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source)
at [email protected](Unit _arg1) in C:\Projects\kopany\build.fsx:line 95
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626
Known workarounds
This code copied from FtpHelper with back-stroke symbols replaced with forward stroke symbol, seems to seal the deal:
module FtpUpload =
let inline private dirNameIsValid (dirName : string) =
let invalidChars = [ "<"; ">"; ":"; """; "/"; "\"; "|"; "?"; "*" ]
let invalidNames =
[ "CON"; "PRN"; "AUX"; "NUL"; "COM1"; "COM2"; "COM3"; "COM4"; "COM5"; "COM6"; "COM7"; "COM8"; "COM9"; "LPT1";
"LPT2"; "LPT3"; "LPT4"; "LPT5"; "LPT6"; "LPT7"; "LPT8"; "LPT9" ]
let invalid1 = List.exists (fun s -> s = dirName.ToUpper()) invalidNames
let invalid2 = List.exists (fun s -> dirName.ToUpper().StartsWith(sprintf "%s." s)) invalidNames
let invalid3 = dirName.EndsWith(" ")
let invalid4 = dirName.EndsWith(".")
let invalid5 = List.exists (fun s -> dirName.Contains(s)) invalidChars
not (invalid1 && invalid2 && invalid3 && invalid4 && invalid5)
let rec uploadAFolder server user pwd (srcPath : string) (rootDir : string) =
logfn "Uploading folder %s" srcPath
let dirInfo = new DirectoryInfo(srcPath)
if dirInfo.Exists && dirNameIsValid rootDir then
dirInfo.GetFileSystemInfos() |> Seq.iter (fun fsi -> upload server user pwd fsi rootDir)
and private upload server user pwd (fsi : FileSystemInfo) (rootDir : string) =
match fsi.GetType().ToString() with
| "System.IO.DirectoryInfo" ->
FtpHelper.createAFolder server user pwd rootDir
FtpHelper.createAFolder server user pwd (sprintf "%s/%s" rootDir fsi.Name)
uploadAFolder server user pwd fsi.FullName (sprintf "%s/%s" rootDir fsi.Name)
| "System.IO.FileInfo" -> FtpHelper.uploadAFile server user pwd (sprintf "%s/%s" rootDir fsi.Name) fsi.FullName
| _ -> logfn "Unknown object found at %A" fsi
Related information
Operating system: Windows 7 Pro SP1
FAKE 4.64.4
.NET Runtime, CoreCLR or Mono Version: .NET Framework 4.5.2
The text was updated successfully, but these errors were encountered:
Description
Build script fails to create remote "Content" folder when uploading compiled web-site over to FTP, using FtpHelper.uploadAFolder method.
Repro steps
Expected behavior
Web-site uploaded successfully to remote FTP server.
Actual behavior
Script fails with the exception:
at System.Text.RegularExpressions.RegexParser.ScanCharEscape()
at System.Text.RegularExpressions.RegexParser.ScanBasicBackslash()
at System.Text.RegularExpressions.RegexParser.ScanBackslash()
at System.Text.RegularExpressions.RegexParser.ScanRegex()
at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)
at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
at Fake.FtpHelper.checkInExistingDirList(String server, String user, String pwd, String destPath, String fname) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 90
at Fake.FtpHelper.createAFolder(String server, String user, String pwd, String destPath) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 116
at Fake.FtpHelper.upload(String server, String user, String pwd, FileSystemInfo fsi, String rootDir) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 140
at [email protected](FileSystemInfo fsi) in D:\code\fake\src\app\FakeLib\FtpHelper.fs:line 134
at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc
2 action, IEnumerable
1 source)at [email protected](Unit _arg1) in C:\Projects\kopany\build.fsx:line 95
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626
Known workarounds
This code copied from FtpHelper with back-stroke symbols replaced with forward stroke symbol, seems to seal the deal:
module FtpUpload =
let inline private dirNameIsValid (dirName : string) =
let invalidChars = [ "<"; ">"; ":"; """; "/"; "\"; "|"; "?"; "*" ]
let invalidNames =
[ "CON"; "PRN"; "AUX"; "NUL"; "COM1"; "COM2"; "COM3"; "COM4"; "COM5"; "COM6"; "COM7"; "COM8"; "COM9"; "LPT1";
"LPT2"; "LPT3"; "LPT4"; "LPT5"; "LPT6"; "LPT7"; "LPT8"; "LPT9" ]
let invalid1 = List.exists (fun s -> s = dirName.ToUpper()) invalidNames
let invalid2 = List.exists (fun s -> dirName.ToUpper().StartsWith(sprintf "%s." s)) invalidNames
let invalid3 = dirName.EndsWith(" ")
let invalid4 = dirName.EndsWith(".")
let invalid5 = List.exists (fun s -> dirName.Contains(s)) invalidChars
not (invalid1 && invalid2 && invalid3 && invalid4 && invalid5)
Related information
The text was updated successfully, but these errors were encountered: