Browse Source

de-string tags in formData/image post route

master
Rich Brown 1 year ago
parent
commit
06feb91e15
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      routes/createRouter.js

+ 4
- 1
routes/createRouter.js View File

@@ -33,13 +33,16 @@ createRouter.post('/form', upload.single('file'), (req, res) => {
if (!sanitizedFile(file)) {
return res.status(403).json({ error: 'not an allowed filetype', url: null });
}
// formData smooshed array of Tags into a string. de-smoosh:
const tags = arrayOfTags.split(',');
console.log(tags);
return req.app.locals.mp
.create(
{
h: 'entry',
name: title,
content: body,
category: arrayOfTags,
category: tags,
photo: [fs.createReadStream(file.path)],
},
'multipart',


Loading…
Cancel
Save