Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4481 AzureFolderProvider uploading same file with different case #4482

Merged
merged 4 commits into from
Mar 8, 2021
Merged
Changes from 2 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 @@ -270,6 +270,21 @@ protected override void MoveFolderInternal(FolderMappingInfo folderMapping, stri
this.ClearCache(folderMapping.FolderMappingID);
}

public override void UpdateFile(IFolderInfo folder, string fileName, Stream content)
{
// Azure is case sensitive. If you update dnninternals.pdf with DNNINTERNALS.pdf, to DNN it's the same
// so it just re-uploads it, causing both files to exist in Azure.
IFileInfo originalFile = FileManager.Instance.GetFile(folder, fileName);
msant7 marked this conversation as resolved.
Show resolved Hide resolved

base.UpdateFile(folder, fileName, content);

if (originalFile != null && originalFile.FileName != fileName)
{
FolderMappingInfo folderMapping = FolderMappingController.Instance.GetFolderMapping(folder.FolderMappingID);
this.DeleteFileInternal(folderMapping, folder.MappedPath + originalFile.FileName);
}
}

protected override void UpdateFileInternal(Stream stream, FolderMappingInfo folderMapping, string uri)
{
var container = this.GetContainer(folderMapping);
Expand Down