Can't upload ZIP file with plugin and subfolders in nop 4.20.
Try to upload this ZIP file
http://foxnetsoft.com/content/files/foxnetsoft.stripedirect.zip
Plugin in this ZIP file has subfolder Resources
ZIP has entry '4.20/FoxNetSoft.StripeDirect/Resources/'
Pay attention to "/" at the end of the file.
Nopcommerce creates empty file Resources instead of creating folder Resources
This line of code has error.
var filePath = _fileProvider.Combine(pathToUpload, fileName.Replace("/", "\\"));
Russian
В архиве с плагином есть подпапка Resources
Ошибка в методе
_fileProvider.Combine
Раньше когда мы передавали параметры со слешами в конце то получали строку со слешами в конце
Пример, как было
_fileProvider.Combine("d:\\nop420", "Resources\\");
Получаем
"d:\nop420\Resources\"
А теперь получаем
"d:\nop420\Resources"
без слеша в конце!
Причина в том что новый метод обезает конечный слеш
public virtual string Combine(params string[] paths)
{
var path = Path.Combine(paths.SelectMany(p => IsUncPath(p) ? new[] { p } : p.Split('\\', '/')).ToArray());
if (Environment.OSVersion.Platform == PlatformID.Unix && !IsUncPath(path))
//add leading slash to correctly form path in the UNIX system
path = "/" + path;
return path;
}
Нужно или Combine поменять или в верхнем методе добавить проверку на папку.