fix: correct images field to be array in recipe creation
All checks were successful
CI / update (push) Successful in 2m49s

The images field was incorrectly set as a single object instead of an array,
causing translation to fail with 'images.forEach is not a function' error.
Also added defensive Array.isArray check in translation service.
This commit is contained in:
2026-01-02 13:05:51 +01:00
parent 0ca86a2402
commit cb9505ff45
2 changed files with 2 additions and 2 deletions

View File

@@ -108,7 +108,7 @@
return {
...card_data,
...add_info,
images: {mediapath: short_name.trim() + '.webp', alt: "", caption: ""},
images: [{mediapath: short_name.trim() + '.webp', alt: "", caption: ""}],
season: season_local,
short_name : short_name.trim(),
portions: portions_local,

View File

@@ -325,7 +325,7 @@ class DeepLTranslationService {
});
// Add image alt and caption texts
const images = recipe.images || [];
const images = Array.isArray(recipe.images) ? recipe.images : [];
images.forEach((img: any) => {
textsToTranslate.push(img.alt || '');
textsToTranslate.push(img.caption || '');