#17387: Failure to save media from a zip file with directory structure that corresponds to a directory in tenant media folder that does not exist yet.

--HG--
branch : 1.x
This commit is contained in:
Dave Reed
2011-03-29 11:50:36 -07:00
parent 200f44fb69
commit 13f4fa195d

View File

@@ -233,6 +233,11 @@ namespace Orchard.FileSystems.Media {
throw new ArgumentException(T("File {0} already exists", fileInfo.Name).ToString());
}
// ensure the directory exists
var dirName = Path.GetDirectoryName(fileInfo.FullName);
if (!Directory.Exists(dirName)) {
Directory.CreateDirectory(dirName);
}
File.WriteAllBytes(fileInfo.FullName, new byte[0]);
return new FileSystemStorageFile(Fix(path), fileInfo);