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.
This commit is contained in:
2026-08-14 11:57:35 +02:00
parent 4e88bdfaa7
commit 05fc8ad80c
4 changed files with 138 additions and 11 deletions
+6 -2
View File
@@ -13,7 +13,9 @@
"DX cluster: the US county column now shows the county the station is logged with, so it agrees with the Info panel.",
"QSL: the manager (QSL_VIA) and the routing method (QSL_SENT_VIA / QSL_RCVD_VIA) are now separate fields, as ADIF defines them.",
"ADIF import: QSL_SENT_VIA no longer lands in the manager field, and QSL_RCVD_VIA is no longer discarded. Both are exported.",
"QSL: logs where a routing word sits in the manager field are counted at startup and corrected only if you accept."
"QSL: logs where a routing word sits in the manager field are counted at startup and corrected only if you accept.",
"QSL designer: copying a design from another profile failed with \"hero photo not found\" — the pictures were never copied.",
"QSL designer: duplicating a profile cloned its card designs without their pictures, leaving designs that could not be printed."
],
"fr": [
"Amplificateurs : coche ceux qui partagent un combiner et ON, OFF et OPERATE agissent sur tous à la fois. Chacun garde ses mesures.",
@@ -26,7 +28,9 @@
"Cluster DX : la colonne comté US affiche le comté du log quand la station y figure, donc identique au panneau Info.",
"QSL : le manager (QSL_VIA) et le mode denvoi (QSL_SENT_VIA / QSL_RCVD_VIA) sont désormais deux champs distincts, comme le veut lADIF.",
"Import ADIF : QSL_SENT_VIA ne se retrouve plus dans le champ manager, et QSL_RCVD_VIA nest plus perdu. Les deux sont exportés.",
"QSL : les logs où un mode denvoi occupe le champ manager sont comptés au démarrage et corrigés seulement si vous acceptez."
"QSL : les logs où un mode denvoi occupe le champ manager sont comptés au démarrage et corrigés seulement si vous acceptez.",
"Concepteur QSL : copier un design depuis un autre profil échouait sur « photo introuvable » — les images n’étaient jamais copiées.",
"Concepteur QSL : dupliquer un profil clonait ses designs sans leurs images, donnant des cartes impossibles à imprimer."
]
},
{