1 Commits
Author SHA1 Message Date
rouggy 05fc8ad80c fix(qsl): copy a design's pictures, not just its row
copyDirContents wrote into a destination it never created, so the first
os.Create returned ENOENT. The caller was written as "ignore os.IsNotExist"
— meant for a design with no pictures at all — and that guard matched the
failed write exactly: nothing was copied, no error surfaced, and validation
two lines later reported "copied design is incomplete: hero photo file
img_… not found" with no way to tell why.

Three fixes, one cause:

  - copyDirContents creates its destination;
  - the caller stats the source folder instead of pattern-matching an error,
    so a genuine copy failure is reported and rolls back both the row and
    the folder;
  - DuplicateProfile had the same defect in its own form — an INSERT … SELECT
    that cloned the template rows and left their photos behind, giving the
    new profile designs with no thumbnail and nothing to print. It now copies
    row and folder together, per template, since each needs its id first.

A test reproduces the original failure: it fails with the exact ENOENT that
was being swallowed.
2026-08-14 11:57:35 +02:00