From b3eeb563f70c6a4beb546744a0b6f7cd3b089a68 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 20 Aug 2025 06:12:48 +0000
Subject: [PATCH] Fix PDF export filename: use JavaScript download with proper
.pdf extension
Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com>
---
Client/Pages/Index.razor.cs | 3 +--
Client/wwwroot/index.html | 1 +
Client/wwwroot/js/fileDownload.js | 18 ++++++++++++++++++
test.pdf | Bin 0 -> 25211 bytes
4 files changed, 20 insertions(+), 2 deletions(-)
create mode 100644 Client/wwwroot/js/fileDownload.js
create mode 100644 test.pdf
diff --git a/Client/Pages/Index.razor.cs b/Client/Pages/Index.razor.cs
index 8b95a79..b7ee35b 100644
--- a/Client/Pages/Index.razor.cs
+++ b/Client/Pages/Index.razor.cs
@@ -104,8 +104,7 @@ namespace ShiftScheduler.Client.Pages
var response = await HttpClient.PostAsJsonAsync("api/shift/export_pdf", shiftsWithTransportList);
var bytes = await response.Content.ReadAsByteArrayAsync();
var base64 = Convert.ToBase64String(bytes);
- var fileUrl = $"data:application/octet-stream;base64,{base64}";
- NavigationManager.NavigateTo(fileUrl, true);
+ await JSRuntime.InvokeVoidAsync("downloadFile", "schedule.pdf", "application/pdf", base64);
}
private async Task SaveScheduleToStorage()
diff --git a/Client/wwwroot/index.html b/Client/wwwroot/index.html
index 9dead99..cfa7310 100644
--- a/Client/wwwroot/index.html
+++ b/Client/wwwroot/index.html
@@ -26,6 +26,7 @@
Reload
🗙
+