FtpServer icon indicating copy to clipboard operation
FtpServer copied to clipboard

GenericAccountDirectories always result in a path relative to the rootPath

Open JeanRessouche opened this issue 3 years ago • 2 comments

Hello, i have the following issue, i think that it was mentioned (but denied) in this case .

services.Configure<DotNetFileSystemOptions>(opt => { opt.RootPath = @"c:\anonymous"; }); ... public IAccountDirectories GetDirectories(IAccountInformation accountInformation) { return new GenericAccountDirectories(rootPath: "c:\mypath"); }

Read/Write operations are performed on c:\anonymous\mypath\

Expected: c:\mypath

JeanRessouche avatar Jan 14 '22 17:01 JeanRessouche

It seems that there was a similar problem in #74 and it seems that the order of the IAccountDirectoryQuery registration is important. It has the be registered after the AddFtpServer, because it'll be "overwritten" if you register it before the AddFtpServer.

fubar-coder avatar Jan 14 '22 18:01 fubar-coder

Hum apparently no i do add the IAccountDirectoryQuery after the AddFtpServer:

               services.Configure<DotNetFileSystemOptions>(opt =>
                {
                    opt.RootPath = _configuration["Messages:Folder"];
                    opt.FlushAfterWrite = true;
                });

                services.AddFtpServer(builder => builder.UseDotNetFileSystem());

                services.AddSingleton<IAccountDirectoryQuery, FtpAccountDirectoryQuery>();

                services.Configure<FtpServerOptions>(opt =>
                {
                    opt.ServerAddress = _configuration["FtpListener:Ip"];
                    opt.Port = _configuration.GetSection("FtpListener").GetValue<int>("Port");
                    opt.MaxActiveConnections = 100;
                    opt.ConnectionInactivityCheckInterval = TimeSpan.FromMinutes(2);
                });

Note: breakpoint do step by my IAccountDirectoryQuery implementation.

JeanRessouche avatar Jan 15 '22 08:01 JeanRessouche