diff --git a/controllers/contextController.js b/controllers/contextController.js index a145e4b..47ae2fc 100644 --- a/controllers/contextController.js +++ b/controllers/contextController.js @@ -228,10 +228,10 @@ class ContextController { const { id } = req.params; const { image } = req.body; - if (!image || !Array.isArray(image) || image.length === 0) { + if (!image || typeof image !== 'string' || image.trim().length === 0) { return res.status(400).json({ success: false, - message: 'Image must be a non-empty array of URLs' + message: 'Image must be a non-empty string (URL)' }); } diff --git a/models/Context.js b/models/Context.js index 48d3b12..c45851d 100644 --- a/models/Context.js +++ b/models/Context.js @@ -45,7 +45,7 @@ const Context = sequelize.define('Context', { }, image: { type: DataTypes.TEXT, - comment: 'Array of image URLs' + comment: 'Single image URL string' }, type_context: { type: DataTypes.STRING(50), diff --git a/public/contexts.html b/public/contexts.html index acc8f95..da2a631 100644 --- a/public/contexts.html +++ b/public/contexts.html @@ -402,9 +402,9 @@