fixes
@@ -211,7 +211,7 @@
211
211
## public/shared-video-player.js
212
212
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
213
213
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
214
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, can optionally use a separate range-prefetch request builder (`buildPrefetchRequest`) so the walker caches multiple subtitle images from one window request, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), supports cache-only foreground playback with `currentFetchEnabled: false` (foreground uses cached frames while walker owns server fetches), supports startup warmup with `initialPrefetchSeconds` (default 60s) so early timeline subtitle frames are requested immediately on player load before playback advances, supports fixed prefetch stride (`prefetchStepSeconds`) and adaptive stride mode (`prefetchAdaptiveStepEnabled` with `prefetchStepSecondsMin`/`prefetchStepSecondsMax`) plus optional adaptive pacing (`prefetchAdaptivePacingEnabled`) to balance cache fill speed against backend request pressure, extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), clamps tail requests to the known video duration when that boundary is available, drives range-prefetch seek markers from the covered-through window end instead of the window start so empty tail windows still reach the video end, merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
214
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, honours an explicitly saved `off` state (`null` name/index) instead of falling back to stream 0/defaults, retries saved/default selection on early `loadedmetadata`/`loadedplaylist` events while no image track is active yet, fetches rendered frames through a caller-supplied request builder, can optionally use a separate range-prefetch request builder (`buildPrefetchRequest`) so the walker caches multiple subtitle images from one window request, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), supports cache-only foreground playback with `currentFetchEnabled: false` (foreground uses cached frames while walker owns server fetches), supports startup warmup with `initialPrefetchSeconds` (default 60s) so early timeline subtitle frames are requested immediately on player load before playback advances, supports fixed prefetch stride (`prefetchStepSeconds`) and adaptive stride mode (`prefetchAdaptiveStepEnabled` with `prefetchStepSecondsMin`/`prefetchStepSecondsMax`) plus optional adaptive pacing (`prefetchAdaptivePacingEnabled`) to balance cache fill speed against backend request pressure, extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), clamps tail requests to the known video duration when that boundary is available, drives range-prefetch seek markers from the covered-through window end instead of the window start so empty tail windows still reach the video end, merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
215
215
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Playback display timing now includes a high-frequency cache-sync loop while playing, so captions can start/end at frame-window boundaries even between sparse `timeupdate` events, reducing late starts and early cut-offs when data is already prefetched.
216
216
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Cache-frame time matching now uses a small epsilon window around start/end timestamps to avoid boundary misses; cache-only mode can also perform a throttled direct current-frame fallback fetch on cache miss (`cacheMissFallbackEnabled`, `cacheMissFallbackIntervalMs`) so subtitles recover without waiting for another seek/timeupdate cycle, fallback fetches preserve prefetch progress so repeated cache misses do not keep resetting subtitle lookahead, and duration metadata hints now extend lookahead prefetch to the known video end even before playback advances.
217
217
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Double-buffering for smooth rapid-transition captions: maintains two image buffers (primary/secondary), pre-loads next caption on secondary while displaying current on primary, swaps smoothly when transition occurs to eliminate flicker when captions appear in quick succession; tracks which frame is loaded in each buffer (`primaryBufferIndex`, `primaryFrameKey`, `secondaryFrameKey`) so the sync loop can detect pre-loaded frames and swap immediately without re-rendering.
@@ -383,7 +383,7 @@
383
383
- (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
384
384
385
385
## public/drag-move.css
386
- .file-item.dragging - Lifted style for real dragged tile.
386
- .file-item.dragging - Hides the dragged tile chrome (background/border) so only icon/text appear to move while keeping a soft drop shadow on the visible content.
387
387
- .file-item.drop-target - Glows folder icon when drag hovers over it.
388
388
- .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
389
389
- .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
@@ -211,7 +211,7 @@211
## public/shared-video-player.js
211
## public/shared-video-player.js
212
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
212
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
213
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
213
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
214
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, can optionally use a separate range-prefetch request builder (`buildPrefetchRequest`) so the walker caches multiple subtitle images from one window request, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), supports cache-only foreground playback with `currentFetchEnabled: false` (foreground uses cached frames while walker owns server fetches), supports startup warmup with `initialPrefetchSeconds` (default 60s) so early timeline subtitle frames are requested immediately on player load before playback advances, supports fixed prefetch stride (`prefetchStepSeconds`) and adaptive stride mode (`prefetchAdaptiveStepEnabled` with `prefetchStepSecondsMin`/`prefetchStepSecondsMax`) plus optional adaptive pacing (`prefetchAdaptivePacingEnabled`) to balance cache fill speed against backend request pressure, extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), clamps tail requests to the known video duration when that boundary is available, drives range-prefetch seek markers from the covered-through window end instead of the window start so empty tail windows still reach the video end, merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
214
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, honours an explicitly saved `off` state (`null` name/index) instead of falling back to stream 0/defaults, retries saved/default selection on early `loadedmetadata`/`loadedplaylist` events while no image track is active yet, fetches rendered frames through a caller-supplied request builder, can optionally use a separate range-prefetch request builder (`buildPrefetchRequest`) so the walker caches multiple subtitle images from one window request, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), supports cache-only foreground playback with `currentFetchEnabled: false` (foreground uses cached frames while walker owns server fetches), supports startup warmup with `initialPrefetchSeconds` (default 60s) so early timeline subtitle frames are requested immediately on player load before playback advances, supports fixed prefetch stride (`prefetchStepSeconds`) and adaptive stride mode (`prefetchAdaptiveStepEnabled` with `prefetchStepSecondsMin`/`prefetchStepSecondsMax`) plus optional adaptive pacing (`prefetchAdaptivePacingEnabled`) to balance cache fill speed against backend request pressure, extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), clamps tail requests to the known video duration when that boundary is available, drives range-prefetch seek markers from the covered-through window end instead of the window start so empty tail windows still reach the video end, merges buffered-end signals from both Video.js/player APIs and underlying media buffered ranges so under-reported player values do not cap subtitle prefetch early, keeps the prefetch frontier pinned to at least current playback time so it chases buffered-ahead range instead of replaying stale lag after video/session changes, coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, ensures force-seek aborts still clear in-flight current-request state so subtitle refreshes continue instead of deadlocking, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
215
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Playback display timing now includes a high-frequency cache-sync loop while playing, so captions can start/end at frame-window boundaries even between sparse `timeupdate` events, reducing late starts and early cut-offs when data is already prefetched.
215
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Playback display timing now includes a high-frequency cache-sync loop while playing, so captions can start/end at frame-window boundaries even between sparse `timeupdate` events, reducing late starts and early cut-offs when data is already prefetched.
216
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Cache-frame time matching now uses a small epsilon window around start/end timestamps to avoid boundary misses; cache-only mode can also perform a throttled direct current-frame fallback fetch on cache miss (`cacheMissFallbackEnabled`, `cacheMissFallbackIntervalMs`) so subtitles recover without waiting for another seek/timeupdate cycle, fallback fetches preserve prefetch progress so repeated cache misses do not keep resetting subtitle lookahead, and duration metadata hints now extend lookahead prefetch to the known video end even before playback advances.
216
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Cache-frame time matching now uses a small epsilon window around start/end timestamps to avoid boundary misses; cache-only mode can also perform a throttled direct current-frame fallback fetch on cache miss (`cacheMissFallbackEnabled`, `cacheMissFallbackIntervalMs`) so subtitles recover without waiting for another seek/timeupdate cycle, fallback fetches preserve prefetch progress so repeated cache misses do not keep resetting subtitle lookahead, and duration metadata hints now extend lookahead prefetch to the known video end even before playback advances.
217
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Double-buffering for smooth rapid-transition captions: maintains two image buffers (primary/secondary), pre-loads next caption on secondary while displaying current on primary, swaps smoothly when transition occurs to eliminate flicker when captions appear in quick succession; tracks which frame is loaded in each buffer (`primaryBufferIndex`, `primaryFrameKey`, `secondaryFrameKey`) so the sync loop can detect pre-loaded frames and swap immediately without re-rendering.
217
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Double-buffering for smooth rapid-transition captions: maintains two image buffers (primary/secondary), pre-loads next caption on secondary while displaying current on primary, swaps smoothly when transition occurs to eliminate flicker when captions appear in quick succession; tracks which frame is loaded in each buffer (`primaryBufferIndex`, `primaryFrameKey`, `secondaryFrameKey`) so the sync loop can detect pre-loaded frames and swap immediately without re-rendering.
@@ -383,7 +383,7 @@383
- (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
383
- (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
384
384
385
## public/drag-move.css
385
## public/drag-move.css
386
- .file-item.dragging - Lifted style for real dragged tile.
386
- .file-item.dragging - Hides the dragged tile chrome (background/border) so only icon/text appear to move while keeping a soft drop shadow on the visible content.
387
- .file-item.drop-target - Glows folder icon when drag hovers over it.
387
- .file-item.drop-target - Glows folder icon when drag hovers over it.
388
- .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
388
- .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
389
- .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
389
- .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
@@ -91,6 +91,8 @@
91
91
92
92
## `test/shared-video-player.test.js`
93
93
- `shared image subtitle prefetching`
94
- `retries saved image subtitle selection when metadata arrives before player ready runs`
95
- `keeps image subtitles off when off was the saved preference`
94
96
95
97
---
96
98
@@ -91,6 +91,8 @@91
91
92
## `test/shared-video-player.test.js`92
## `test/shared-video-player.test.js`93
- `shared image subtitle prefetching`93
- `shared image subtitle prefetching`94
- `retries saved image subtitle selection when metadata arrives before player ready runs`95
- `keeps image subtitles off when off was the saved preference`94
96
95
---97
---96
98
@@ -5052,6 +5052,7 @@ async function uploadFiles (fileList)
5052
5052
{
5053
5053
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }
5054
5054
if (!canWrite()) { toast('No write access.', 'err'); return; }
5055
if (!canStartUpload()) return;
5055
5056
5056
5057
const files = Array.from(fileList || []);
5057
5058
if (!files.length) return;
@@ -5127,6 +5128,13 @@ async function uploadFiles (fileList)
5127
5128
}
5128
5129
}
5129
5130
5131
function canStartUpload ()
5132
{
5133
if (!STATE.uploadInProgress) return true;
5134
toast('An upload is already in progress.', 'err');
5135
return false;
5136
}
5137
5130
5138
function createUploadProgressBar (text)
5131
5139
{
5132
5140
const abortSignal = createUploadAbortSignal();
@@ -5311,6 +5319,7 @@ async function uploadFolderInputFiles (fileList)
5311
5319
{
5312
5320
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }
5313
5321
if (!canWrite()) { toast('No write access.', 'err'); return; }
5322
if (!canStartUpload()) return;
5314
5323
if (!fileList || !fileList.length) return;
5315
5324
5316
5325
const files = Array.from(fileList);
@@ -5453,6 +5462,7 @@ async function uploadEntries (entries)
5453
5462
{
5454
5463
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }
5455
5464
if (!canWrite()) { toast('No write access.', 'err'); return; }
5465
if (!canStartUpload()) return;
5456
5466
5457
5467
const uploadUi = createUploadProgressBar('Scanning...');
5458
5468
const { wrap, abortSignal } = uploadUi;
@@ -5052,6 +5052,7 @@ async function uploadFiles (fileList)5052
{5052
{5053
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }5053
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }5054
if (!canWrite()) { toast('No write access.', 'err'); return; }5054
if (!canWrite()) { toast('No write access.', 'err'); return; }5055
if (!canStartUpload()) return;5055
5056
5056
const files = Array.from(fileList || []);5057
const files = Array.from(fileList || []);5057
if (!files.length) return;5058
if (!files.length) return;@@ -5127,6 +5128,13 @@ async function uploadFiles (fileList)5127
}5128
}5128
}5129
}5129
5130
5131
function canStartUpload ()5132
{5133
if (!STATE.uploadInProgress) return true;5134
toast('An upload is already in progress.', 'err');5135
return false;5136
}5137
5130
function createUploadProgressBar (text)5138
function createUploadProgressBar (text)5131
{5139
{5132
const abortSignal = createUploadAbortSignal();5140
const abortSignal = createUploadAbortSignal();@@ -5311,6 +5319,7 @@ async function uploadFolderInputFiles (fileList)5311
{5319
{5312
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }5320
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }5313
if (!canWrite()) { toast('No write access.', 'err'); return; }5321
if (!canWrite()) { toast('No write access.', 'err'); return; }5322
if (!canStartUpload()) return;5314
if (!fileList || !fileList.length) return;5323
if (!fileList || !fileList.length) return;5315
5324
5316
const files = Array.from(fileList);5325
const files = Array.from(fileList);@@ -5453,6 +5462,7 @@ async function uploadEntries (entries)5453
{5462
{5454
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }5463
if (!STATE.currentDir) { toast('Open a folder first.', 'err'); return; }5455
if (!canWrite()) { toast('No write access.', 'err'); return; }5464
if (!canWrite()) { toast('No write access.', 'err'); return; }5465
if (!canStartUpload()) return;5456
5466
5457
const uploadUi = createUploadProgressBar('Scanning...');5467
const uploadUi = createUploadProgressBar('Scanning...');5458
const { wrap, abortSignal } = uploadUi;5468
const { wrap, abortSignal } = uploadUi;@@ -3,13 +3,21 @@
3
3
========================================================= */
4
4
5
5
/* Item being actively dragged: lifted shadow + accent border */
6
.file-item.dragging {
7
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
8
border-color: var(--accent, #5b7fff) !important;
6
.file-item.dragging,
7
.file-item.dragging:hover,
8
.file-item.dragging.selected {
9
background: transparent !important;
10
border-color: transparent !important;
11
box-shadow: none;
9
12
z-index: 9999;
10
13
cursor: grabbing !important;
11
14
}
12
15
16
.file-item.dragging .icon,
17
.file-item.dragging .name {
18
filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.38));
19
}
20
13
21
/* Folder highlighted while a dragged item hovers over it */
14
22
.file-item.drop-target .icon {
15
23
filter: drop-shadow(0 0 6px var(--accent, #5b7fff)) brightness(1.25);
@@ -3,13 +3,21 @@3
========================================================= */
3
========================================================= */
4
4
5
/* Item being actively dragged: lifted shadow + accent border */
5
/* Item being actively dragged: lifted shadow + accent border */
6
.file-item.dragging {
6
.file-item.dragging,
7
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
7
.file-item.dragging:hover,
8
border-color: var(--accent, #5b7fff) !important;
8
.file-item.dragging.selected {
9
background: transparent !important;
10
border-color: transparent !important;
11
box-shadow: none;
9
z-index: 9999;
12
z-index: 9999;
10
cursor: grabbing !important;
13
cursor: grabbing !important;
11
}
14
}
12
15
16
.file-item.dragging .icon,
17
.file-item.dragging .name {
18
filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.38));
19
}
20
13
/* Folder highlighted while a dragged item hovers over it */
21
/* Folder highlighted while a dragged item hovers over it */
14
.file-item.drop-target .icon {
22
.file-item.drop-target .icon {
15
filter: drop-shadow(0 0 6px var(--accent, #5b7fff)) brightness(1.25);
23
filter: drop-shadow(0 0 6px var(--accent, #5b7fff)) brightness(1.25);
@@ -94,7 +94,20 @@ const storage = {
94
94
{
95
95
if (cleaned) return done(null);
96
96
cleaned = true;
97
unlinkIfExists(tempPath, done);
97
98
const removeTempFile = () => unlinkIfExists(tempPath, done);
99
if (out.closed)
100
{
101
removeTempFile();
102
return;
103
}
104
105
out.once('close', removeTempFile);
106
out.once('error', () =>
107
{
108
// The upload is already failing; close will drive temp-file cleanup.
109
});
110
if (!out.destroyed) out.destroy();
98
111
};
99
112
100
113
const fail = (err) =>
@@ -104,18 +117,7 @@ const storage = {
104
117
stopPiping();
105
118
detach();
106
119
107
const finishFailure = () =>
108
{
109
cleanup((cleanupErr) => cb(cleanupErr || err));
110
};
111
112
if (out.destroyed || out.writableEnded)
113
{
114
finishFailure();
115
return;
116
}
117
118
out.end(finishFailure);
120
cleanup((cleanupErr) => cb(cleanupErr || err));
119
121
};
120
122
121
123
const succeed = () =>
@@ -94,7 +94,20 @@ const storage = {94
{94
{95
if (cleaned) return done(null);95
if (cleaned) return done(null);96
cleaned = true;96
cleaned = true;97
unlinkIfExists(tempPath, done);97
98
const removeTempFile = () => unlinkIfExists(tempPath, done);99
if (out.closed)100
{101
removeTempFile();102
return;103
}104
105
out.once('close', removeTempFile);106
out.once('error', () =>107
{108
// The upload is already failing; close will drive temp-file cleanup.109
});110
if (!out.destroyed) out.destroy();98
};111
};99
112
100
const fail = (err) =>113
const fail = (err) =>@@ -104,18 +117,7 @@ const storage = {104
stopPiping();117
stopPiping();105
detach();118
detach();106
119
107
const finishFailure = () =>120
cleanup((cleanupErr) => cb(cleanupErr || err));108
{109
cleanup((cleanupErr) => cb(cleanupErr || err));110
};111
112
if (out.destroyed || out.writableEnded)113
{114
finishFailure();115
return;116
}117
118
out.end(finishFailure);119
};121
};120
122
121
const succeed = () =>123
const succeed = () =>