Clean up converted upload sources
This commit is contained in:
parent
e452b0f000
commit
25264517a9
@ -5,6 +5,11 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
|
||||
|
||||
---
|
||||
|
||||
## [1.20.45] — 2026-08-19
|
||||
|
||||
### Fixed
|
||||
- **Temporary upload sources are now removed after conversion.** Audio previews no longer leave the original uploaded file behind in the temporary directory alongside the registered WAV.
|
||||
|
||||
## [1.20.44] — 2026-08-19
|
||||
|
||||
### Fixed
|
||||
|
||||
@ -149,12 +149,22 @@ async def upload(file: UploadFile = File(...)):
|
||||
if suffix not in _UPLOAD_EXTS:
|
||||
raise HTTPException(400, "Unsupported audio/video file type")
|
||||
dest = TEMP_DIR / f"{uuid.uuid4().hex}{suffix}"
|
||||
with dest.open("wb") as f:
|
||||
_copy_limited(file.file, f, _MAX_UPLOAD_BYTES)
|
||||
try:
|
||||
with dest.open("wb") as f:
|
||||
_copy_limited(file.file, f, _MAX_UPLOAD_BYTES)
|
||||
wav = _to_wav_24k(dest)
|
||||
except Exception as e:
|
||||
if isinstance(e, HTTPException):
|
||||
raise
|
||||
raise HTTPException(400, f"Audio conversion failed: {e}")
|
||||
finally:
|
||||
# The converted WAV is registered below; the original upload is only
|
||||
# an intermediate and must not accumulate in TEMP_DIR after every
|
||||
# preview/upload operation.
|
||||
try:
|
||||
dest.unlink(missing_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
fid = uuid.uuid4().hex
|
||||
_registry_put(fid, wav)
|
||||
return {"id": fid, "duration": _duration(wav), "filename": file.filename}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<meta name="theme-color" content="#2563EB">
|
||||
<meta name="app-version" content="1.20.44">
|
||||
<meta name="app-version" content="1.20.45">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="icon" href="/static/icon.svg" type="image/svg+xml">
|
||||
<link rel="apple-touch-icon" href="/static/icon.svg">
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<!-- ── Core styles (local — no CDN dependency for first paint) ────────── -->
|
||||
<link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css">
|
||||
<link rel="stylesheet" href="/static/style.css?v=1.20.44">
|
||||
<link rel="stylesheet" href="/static/style.css?v=1.20.45">
|
||||
|
||||
|
||||
<!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── -->
|
||||
@ -378,7 +378,7 @@ window.toggleNavTree = function(treeId, chevronId) {
|
||||
</script>
|
||||
|
||||
<!-- loader.js: fetches sections → loads JS modules → removes skeleton -->
|
||||
<script src="/static/loader.js?v=1.20.44"></script>
|
||||
<script src="/static/loader.js?v=1.20.45"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -46,6 +46,7 @@ test('core sections render', async ({ page }) => {
|
||||
test('clone tabs switch and show one panel at a time', async ({ page }) => {
|
||||
await page.goto('/', { waitUntil: 'domcontentloaded' });
|
||||
await navTo(page, 's-clone');
|
||||
await page.waitForFunction(() => typeof window._cloneScheduleAutoSave === 'function', null, { timeout: 15_000 });
|
||||
await expect(page.locator('.clone-src-tab[data-src="url"]')).toBeVisible({ timeout: 10_000 });
|
||||
// The app uses a fixed bottom status bar; dispatching the real DOM click
|
||||
// avoids a viewport-dependent overlap while still exercising the handler.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user