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.