fix: correct images field to be array in recipe creation
All checks were successful
CI / update (push) Successful in 2m49s
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:
@@ -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 || '');
|
||||
|
||||
Reference in New Issue
Block a user