Skip to content

[previews] Fix upload error messages, frame extraction and eraser rendering#1099

Merged
nledez merged 4 commits into
cgwire:mainfrom
frankrousseau:main
Jun 2, 2026
Merged

[previews] Fix upload error messages, frame extraction and eraser rendering#1099
nledez merged 4 commits into
cgwire:mainfrom
frankrousseau:main

Conversation

@frankrousseau
Copy link
Copy Markdown
Contributor

Problems

  • Preview upload failures were misleading: a revision conflict returned a bare 400, and movie processing failures were always labelled "Normalization failed" even when normalization was disabled
  • Single-PNG-frame extraction produced inconsistent output because ffmpeg was not told it was overwriting an existing frame
  • The eraser annotation field was not handled by the renderer, so erased strokes were not applied

Solutions

  • Make the revision-conflict message actionable, and report genuine server-side movie processing failures as 500 with the cause in data.reason (400 kept only for bad uploads)
  • Pass update=1 to ffmpeg when writing a single PNG frame
  • Handle the eraser annotation field in the renderer

frankrousseau and others added 4 commits June 2, 2026 11:36
Kitsu's new vector eraser stores an `eraser` object on each erasable
shape: a fabric Group of paths in the parent's local centered frame,
composited destination-out at render time. Mirror that on the Pillow
side: render the parent on a fresh transparent layer, stamp the eraser
paths into an L-mode mask (chaining path-local → eraser-centered →
parent-centered → canvas → image transforms), and subtract the mask
from the layer's alpha before compositing onto the overlay.

The path-to-segments flattener is extracted from `_draw_path` so the
mask renderer reuses it. Tests cover hole-in-rect, eraser-follows-
rotated-parent, isolation from siblings, PSStroke mid-segment erase
and the empty-eraser no-op.
ffmpeg ≥ 6's image2 muxer refuses non-pattern output filenames unless
`-update 1` is set, logging "filename does not contain an image
sequence pattern" and intermittently skipping the write. Frame
extraction and thumbnail generation both target a plain `.png` path,
so they now pass `update=1` alongside `vframes=1`. The option is a
no-op on older ffmpeg.
Make the revision-conflict message actionable instead of a bare
"Revision N already exists for this task." (tells the user to pick
another revision or omit it to auto-increment).

Stop mislabelling every movie failure as "Normalization failed.":
when normalization is disabled the message no longer mentions it, and
a genuine server-side processing failure (ffmpeg, storage) is now
reported as a 500 carrying the underlying cause in data.reason rather
than a misleading 400. A bad upload (empty/corrupted transfer) still
returns 400.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nledez nledez self-requested a review June 2, 2026 12:23
Copy link
Copy Markdown
Contributor

@nledez nledez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nledez nledez merged commit 0ebda80 into cgwire:main Jun 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants