|
@@ -162,8 +162,13 @@ const upload = require('multer')({ dest: uploadPath })
|
|
|
console.log('SOME UPLOAD', decoded, req.file)
|
|
|
|
|
|
let {models: {Image }} = await getModels(decoded.sub)
|
|
|
- let image = await Image.fromFileData(req.file)
|
|
|
- res.end(JSON.stringify({_id: image._id, url: image.url}))
|
|
|
+ if (req.file){
|
|
|
+ let image = await Image.fromFileData(req.file)
|
|
|
+ res.end(JSON.stringify({_id: image._id, url: image.url}))
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ res.end('дичь')
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
res.status(503).send('permission denied')
|