From dec07c931c3c810e2e38bb55dd3d0e1cf0320268 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Mon, 29 Nov 2021 18:40:22 +0300 Subject: [PATCH] moved from d50a38db --- config/appsettings.json | 2 +- .../Core/Core/Security/FileSecurity.cs | 22 +++++++++---------- products/ASC.Files/Core/Utils/EntryManager.cs | 19 ++++++++++++---- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/config/appsettings.json b/config/appsettings.json index a75d562237..751a44da4f 100644 --- a/config/appsettings.json +++ b/config/appsettings.json @@ -60,7 +60,7 @@ "commented-docs": [ ".docx", ".docxf", ".xlsx", ".pptx" ], "convert-docs": [ ".pptm", ".ppt", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".rtf" ], "edited-docs": [ ".pptx", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".xlsx", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".csv", ".docx", ".docxf", ".oform", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".txt", ".rtf", ".mht", ".html", ".htm" ], - "encrypted-docs": [ ".docx", ".docxf", ".xlsx", ".pptx" ], + "encrypted-docs": [ ".docx", ".docxf", ".xlsx", ".pptx", ".oform" ], "formfilling-docs": [ ".oform" ], "customfilter-docs": [ ".xlsx" ], "reviewed-docs": [ ".docx", ".docxf" ], diff --git a/products/ASC.Files/Core/Core/Security/FileSecurity.cs b/products/ASC.Files/Core/Core/Security/FileSecurity.cs index f9fc79937b..e869a10a4c 100644 --- a/products/ASC.Files/Core/Core/Security/FileSecurity.cs +++ b/products/ASC.Files/Core/Core/Security/FileSecurity.cs @@ -462,18 +462,18 @@ namespace ASC.Files.Core.Security continue; } - if (e.FileEntryType == FileEntryType.File - && file.IsFillFormDraft) - { - e.Access = FileShare.FillForms; + //if (e.FileEntryType == FileEntryType.File + // && file.IsFillFormDraft) + //{ + // e.Access = FileShare.FillForms; - if (action != FilesSecurityActions.Read - && action != FilesSecurityActions.FillForms - && action != FilesSecurityActions.Delete) - { - continue; - } - } + // if (action != FilesSecurityActions.Read + // && action != FilesSecurityActions.FillForms + // && action != FilesSecurityActions.Delete) + // { + // continue; + // } + //} if (e.RootFolderType == FolderType.USER && e.RootFolderCreator == userId && !isVisitor) { diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index 68a26d02cc..0b53870333 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -1007,8 +1007,14 @@ namespace ASC.Web.Files.Utils if (checkRight && (!forcesave.HasValue || forcesave.Value == ForcesaveType.None) && FileTracker.IsEditing(file.ID)) throw new Exception(FilesCommonResource.ErrorMassage_SecurityException_UpdateEditingFile); if (file.RootFolderType == FolderType.TRASH) throw new Exception(FilesCommonResource.ErrorMassage_ViewTrashItem); - var currentExt = file.ConvertedExtension; - if (string.IsNullOrEmpty(newExtension)) newExtension = FileUtility.GetInternalExtension(file.Title); + var currentExt = file.ConvertedExtension; + if (string.IsNullOrEmpty(newExtension)) + { + if (currentExt != FileUtility.MasterFormExtension) + newExtension = FileUtility.GetInternalExtension(file.Title); + else + newExtension = currentExt; + } var replaceVersion = false; if (file.Forcesave != ForcesaveType.None) @@ -1036,8 +1042,13 @@ namespace ASC.Web.Files.Utils if (!storeTemplate.IsDirectory(path)) { path = FileConstant.NewDocPath + "en-US/"; - } - path += "new" + FileUtility.GetInternalExtension(file.Title); + } + + var fileExt = currentExt != FileUtility.MasterFormExtension + ? FileUtility.GetInternalExtension(file.Title) + : currentExt; + + path += "new" + fileExt; //todo: think about the criteria for saving after creation if (!storeTemplate.IsFile(path) || file.ContentLength != storeTemplate.GetFileSize("", path))