aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/transfers.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transfers.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transfers.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transfers.js b/packages/meshbay-hub/src/meshbay_hub/static/transfers.js
index 0d012ed..7036c4f 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transfers.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transfers.js
@@ -80,8 +80,9 @@ export class TransferStore {
settled: it.samples.length > 2
&& (it.samples[it.samples.length - 1].t - it.samples[0].t) >= 3000,
percent: it.total ? Math.min(100, Math.round(it.done / it.total * 100)) : 0,
- // Only for a file written into a folder the browser granted us: that is
- // the one case where the page can read its own download back.
+ // Where the finished file can be read back — a granted folder, the
+ // in-memory floor, the app's own save — and only for a type that is
+ // safe to open (downloads.openInTab).
canOpen: it.status === 'done' && typeof it.open === 'function',
// Whether the target can be stopped and continued. False is the honest
// answer for a service-worker stream, and the button is not drawn.
@@ -225,6 +226,9 @@ export class TransferStore {
// the button is offered where it works and nowhere else — a pause
// that silently restarts from zero is worse than no pause.
if (ready && ready.pausable) item.pausable = true;
+ // Likewise whether "Open" can do anything: a page opens in a tab
+ // only a type that runs nothing (downloads.openInTab).
+ if (ready && ready.openable === false) item.open = null;
item.status = 'running';
this._emit();
}