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.
This commit is contained in:
parent
ccbcc34bd3
commit
33fad8911b
4 changed files with 14 additions and 4 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue