Skip to content
Merged
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
26 changes: 19 additions & 7 deletions LearningHub.Nhs.WebUI/Services/FileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,26 @@ public async Task<FileDownloadResponse> DownloadFileAsync(string filePath, strin

try
{
// Directly download the entire file as a stream
var response = await file.DownloadAsync();
return new FileDownloadResponse
if (fileSize <= 900 * 1024 * 1024)
{
Content = response.Value.Content,
ContentType = properties.Value.ContentType,
ContentLength = fileSize,
};
// Directly download the entire file as a stream
var response = await file.DownloadAsync();
return new FileDownloadResponse
{
Content = response.Value.Content,
ContentType = properties.Value.ContentType,
ContentLength = fileSize,
};
}
else
{
return new FileDownloadResponse
{
Content = await file.OpenReadAsync(),
ContentType = properties.Value.ContentType,
ContentLength = fileSize,
};
}
}
catch (Exception ex)
{
Expand Down
Loading