Fix issue where unable to access files in App_data (#8180)

This commit is contained in:
cmsilv
2019-04-18 12:07:26 -07:00
committed by Sébastien Ros
parent 7b346f8a4d
commit 2a047eaab3
@@ -141,6 +141,12 @@ namespace Orchard.FileSystems.AppData {
// move to destination // move to destination
// will throw exception if destination exists // will throw exception if destination exists
File.Move(tempPath, path); File.Move(tempPath, path);
// Modify file's access control to inherit permissions from parent directory. When files are moved they do not inherit
// permissions from the parent directory by default
System.Security.AccessControl.FileSecurity fileSecurity = File.GetAccessControl(path);
fileSecurity.SetAccessRuleProtection(false, false);
File.SetAccessControl(path, fileSecurity);
} }
public Stream CreateFile(string path) { public Stream CreateFile(string path) {