diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-30 13:22:17 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-30 13:22:17 +0200 |
| commit | f211a13dc2e5dd82eaba49222171d6f29d858eb5 (patch) | |
| tree | 222b9d55116179e35c3013239b7f8e1120907e91 /packages/meshbay-hub/src/meshbay_hub/static/transfers.js | |
| parent | 87725dc7a2da27c2ca3b9e58af751f0e6f8c9de7 (diff) | |
| download | meshbay-f211a13dc2e5dd82eaba49222171d6f29d858eb5.tar.gz | |
fix(hub): a downloaded file opens in a tab only under a type that runs nothing
Open is offered for PDFs, raster images, audio, video and plain text, typed
from the name; HTML, SVG and the rest are not opened in the hub's origin.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transfers.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/transfers.js | 8 |
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(); } |