Skip to content

PB-1814: Fix download print issue since Service-Worker introduction#1371

Merged
pakb merged 2 commits intodevelopfrom
fix-PB-1814-print-download
Jul 3, 2025
Merged

PB-1814: Fix download print issue since Service-Worker introduction#1371
pakb merged 2 commits intodevelopfrom
fix-PB-1814-print-download

Conversation

@pakb
Copy link
Contributor

@pakb pakb commented Jul 3, 2025

Removes the file-saver dependency and implements a custom downloadFile function to handle file downloads.

This change ensures compatibility and addresses potential issues related to browser-specific behavior while Service-Worker is caching our app. Prior to this change, opening the download URL the way it was was leading to a white page where it looked like Service-Worker was trying to inject the app code there (and it failed), no PDF was downloaded

Test link

Removes the `file-saver` dependency and implements a custom `downloadFile` function to handle file downloads.

This change ensures compatibility and addresses potential issues related to browser-specific behavior while Service-Worker is caching our app.
Prior to this change, opening the download URL the way it was was leading to a white page where it looked like Service-Worker was trying to inject the app code there (and it failed), no PDF was downloaded
@github-actions github-actions bot added the bug label Jul 3, 2025
@cypress
Copy link

cypress bot commented Jul 3, 2025

web-mapviewer    Run #5494

Run Properties:  status check passed Passed #5494  •  git commit ee27a3d083: PB-1814: use local time in file names instead of UTC time
Project web-mapviewer
Branch Review fix-PB-1814-print-download
Run status status check passed Passed #5494
Run duration 05m 33s
Commit git commit ee27a3d083: PB-1814: use local time in file names instead of UTC time
Committer Pascal Barth
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 20
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 254
View all changes introduced in this branch ↗︎

} else {
window.location = documentUrl
}
const fileName = `${hostname.value}_${new Date().toISOString()}.pdf`.replaceAll(':', '_')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this date string is in UTC are we sure we do not want a local timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the usePrint composable is also using a Z in its format, so it was already UTC before.

Might be better to use the current time on the user's machine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the generateFilename function to use local time, and have used it wherever possible, should be local time in file names now

@pakb pakb force-pushed the fix-PB-1814-print-download branch 2 times, most recently from febb5fe to d16d031 Compare July 3, 2025 09:49
@pakb pakb force-pushed the fix-PB-1814-print-download branch from d16d031 to ee27a3d Compare July 3, 2025 10:26
@pakb pakb merged commit 5f6a41a into develop Jul 3, 2025
6 checks passed
@pakb pakb deleted the fix-PB-1814-print-download branch July 3, 2025 10:43
@ibauersachs
Copy link

@pakb Printing of maps is broken with v1.57.1 on Firefox: the downloaded PDF contains some HTML (without body). Chrome works.

@pakb
Copy link
Contributor Author

pakb commented Jul 7, 2025

@pakb Printing of maps is broken with v1.57.1 on Firefox: the downloaded PDF contains some HTML (without body). Chrome works.

#1373 is an attempt at fixing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants