Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal void Persist(string fullPath)
try
{
AccessControlSections persistRules = GetAccessControlSectionsFromChanges();
base.Persist(fullPath, persistRules);
base.Persist(PathInternal.EnsureExtendedPrefixIfNeeded(fullPath), persistRules);
OwnerModified = GroupModified = AuditRulesModified = AccessRulesModified = false;
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ public void SetAccessControl_FileInfo_FileSecurity_Success()
fileInfo.SetAccessControl(fileSecurity);
}

[Fact]
public void SetAccessControl_FileInfo_FileSecurity_Success_NameLongerThanMaxShortPath()
{
using var directory = new TempAclDirectory();

const int MaxShortPath = 260;
int fileNameLength = Math.Max(MaxShortPath - directory.Path.Length, 1);

string path = Path.Combine(directory.Path, new string('1', fileNameLength) + ".txt");
using var file = new TempFile(path, 1);
var fileInfo = new FileInfo(file.Path);
FileSecurity fileSecurity = fileInfo.GetAccessControl(AccessControlSections.Access);

var newAccessRule = new FileSystemAccessRule(Helpers.s_NetworkServiceNTAccount, FileSystemRights.Write, AccessControlType.Allow);
fileSecurity.SetAccessRule(newAccessRule);

fileInfo.SetAccessControl(fileSecurity);
}

[Fact]
public void SetAccessControl_FileStream_FileSecurity_InvalidArguments()
{
Expand Down
Loading