diff --git a/products/ASC.Files/Core/Core/FileStorageService.cs b/products/ASC.Files/Core/Core/FileStorageService.cs index 2efacceda8..cfd141d5c6 100644 --- a/products/ASC.Files/Core/Core/FileStorageService.cs +++ b/products/ASC.Files/Core/Core/FileStorageService.cs @@ -3139,7 +3139,8 @@ public async Task GetPrimaryExternalLinkAsync( DateTime expirationDate = default, bool denyDownload = false, bool requiredAuth = false, - string password = null) + string password = null, + bool allowUnlimitedDate = false) { var fileDao = daoFactory.GetFileDao(); var folderDao = daoFactory.GetFolderDao(); @@ -3188,7 +3189,7 @@ public async Task GetPrimaryExternalLinkAsync( primary: true, expirationDate: expirationDate != default ? expirationDate - : entry.RootFolderType == FolderType.USER ? DateTime.UtcNow.Add(filesLinkUtility.DefaultLinkLifeTime) : default, + : entry.RootFolderType == FolderType.USER && !allowUnlimitedDate ? DateTime.UtcNow.Add(filesLinkUtility.DefaultLinkLifeTime) : default, denyDownload: denyDownload, requiredAuth: requiredAuth, password: password); diff --git a/products/ASC.Files/Server/Api/FilesController.cs b/products/ASC.Files/Server/Api/FilesController.cs index 2b74ed2be1..4bff6c0a94 100644 --- a/products/ASC.Files/Server/Api/FilesController.cs +++ b/products/ASC.Files/Server/Api/FilesController.cs @@ -428,7 +428,7 @@ public async Task> UpdateFileStreamFromFormAsync(FileStreamRequestDto [HttpPost("file/{id}/link")] public async Task CreatePrimaryExternalLinkAsync(FileLinkRequestDto inDto) { - var linkAce = await fileStorageService.GetPrimaryExternalLinkAsync(inDto.Id, FileEntryType.File, inDto.File.Access, expirationDate: inDto.File.ExpirationDate, requiredAuth: inDto.File.Internal); + var linkAce = await fileStorageService.GetPrimaryExternalLinkAsync(inDto.Id, FileEntryType.File, inDto.File.Access, expirationDate: inDto.File.ExpirationDate, requiredAuth: inDto.File.Internal, allowUnlimitedDate: true); return await fileShareDtoHelper.Get(linkAce); }