|
|
@@ -73,7 +73,16 @@ const TEMPLATE_OPTIONS: TemplateOption[] = [
|
|
|
|
|
|
function openBlobInNewTab(blob: Blob): void {
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
- const win = window.open(url, '_blank', 'noopener,noreferrer');
|
|
|
+ // Do NOT pass `noopener,noreferrer`: per the WindowFeatures spec, `noopener`
|
|
|
+ // forces window.open to return `null` even on success, which made the
|
|
|
+ // `if (!win)` popup-block fallback below fire on EVERY click — so the blob
|
|
|
+ // tab opened (downloading a random-named PDF on systems without an inline
|
|
|
+ // viewer) AND the `<a download>` fallback fired (downloading a second copy
|
|
|
+ // named bambuddy-labels.pdf). Two identical PDFs per click — issue #1628.
|
|
|
+ // The blob is same-origin, the destination is a passive PDF tab with no
|
|
|
+ // script context, and `noreferrer` is a no-op for blob URLs, so dropping
|
|
|
+ // these flags has no security impact.
|
|
|
+ const win = window.open(url, '_blank');
|
|
|
if (!win) {
|
|
|
const a = document.createElement('a');
|
|
|
a.href = url;
|