public async Task <SendFileDownloadDataResponseModel> GetSendFileDownloadData(string id)
 {
     return(new SendFileDownloadDataResponseModel()
     {
         Id = id,
         Url = await _sendFileStorageService.GetSendFileDownloadUrlAsync(id),
     });
 }
Example #2
0
        // Response: Send, password required, password invalid
        public async Task <(string, bool, bool)> GetSendFileDownloadUrlAsync(Send send, string fileId, string password)
        {
            if (send.Type != SendType.File)
            {
                throw new BadRequestException("Can only get a download URL for a file type of Send");
            }

            var(grantAccess, passwordRequired, passwordInvalid) = SendCanBeAccessed(send, password);

            if (!grantAccess)
            {
                return(null, passwordRequired, passwordInvalid);
            }

            send.AccessCount++;
            await _sendRepository.ReplaceAsync(send);

            return(await _sendFileStorageService.GetSendFileDownloadUrlAsync(send, fileId), false, false);
        }