From 33fad8911bddc99a7ba4d28958d5c1ba5c5c56ef Mon Sep 17 00:00:00 2001 From: npeter83 Date: Tue, 7 Jul 2026 21:40:15 +0200 Subject: [PATCH] fix(downloads): clip long titles to fit display_name (VARCHAR 255) A download whose source title exceeded 255 chars (e.g. a recipe baked into a Facebook video's title) failed with a StringDataRightTruncation: the worker auto-fills an empty display_name from the title, which overflows the 255-char column. Clip the title to 255 at every point it flows into display_name (worker completion paths + enqueue); the full title is untouched on the asset. Pre-existing latent bug, surfaced by an unusually long title. Release v0.31.1. --- VERSION | 2 +- backend/app/downloads/service.py | 2 +- backend/app/worker.py | 6 ++++-- frontend/src/lib/releaseNotes.ts | 8 ++++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 26bea73..f176c94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.31.0 +0.31.1 diff --git a/backend/app/downloads/service.py b/backend/app/downloads/service.py index 27204e2..b20304b 100644 --- a/backend/app/downloads/service.py +++ b/backend/app/downloads/service.py @@ -114,7 +114,7 @@ def enqueue( source_ref=source_ref, profile_id=profile_id, profile_snapshot=spec, - display_name=display_name or (asset.title if asset.status == "ready" else None), + display_name=display_name or (asset.title[:255] if asset.status == "ready" and asset.title else None), status="queued", queue_pos=_next_queue_pos(db), ) diff --git a/backend/app/worker.py b/backend/app/worker.py index 73d8dc2..3f60a11 100644 --- a/backend/app/worker.py +++ b/backend/app/worker.py @@ -203,7 +203,8 @@ def _finish_from_cache(job_id: int, asset_id: int) -> None: job.progress = 100 job.phase = None if not job.display_name: - job.display_name = asset.title + # display_name is VARCHAR(255); a title can be longer (e.g. a recipe in the title). + job.display_name = asset.title[:255] if asset.title else None asset.last_access_at = datetime.now(timezone.utc) db.commit() @@ -425,7 +426,8 @@ def _download(job_id: int, asset_id: int, source_kind: str, source_ref: str, spe job.speed_bps = None job.eta_s = None if not job.display_name: - job.display_name = meta.title + # display_name is VARCHAR(255) — clip a long title (see _fill_asset_meta_early). + job.display_name = meta.title[:255] if meta.title else None db.commit() log.info("job %s done: %s", job_id, rel) diff --git a/frontend/src/lib/releaseNotes.ts b/frontend/src/lib/releaseNotes.ts index 226bcce..7c00035 100644 --- a/frontend/src/lib/releaseNotes.ts +++ b/frontend/src/lib/releaseNotes.ts @@ -14,6 +14,14 @@ export interface ReleaseEntry { } export const RELEASE_NOTES: ReleaseEntry[] = [ + { + version: "0.31.1", + date: "2026-07-07", + summary: "Fix: a download could fail when the video's title was very long.", + fixes: [ + "Downloads: fixed a download failing right at the end when the source's title was very long (e.g. a whole recipe in the title) — the auto-filled display name overflowed its limit. Long titles are now trimmed for the name; the full title still shows everywhere else.", + ], + }, { version: "0.31.0", date: "2026-07-07",