I'm not sure how this is supposed to work, however when updating an article by re-uploading the image, the old image does not get removed from S3. I guess article.js is missing a pre('update') similar to the remove hook, but only if req.files.image===true ?
ArticleSchema.pre('remove', function (next) {
var imager = new Imager(imagerConfig, 'S3');
var files = this.image.files;
// if there are files associated with the item, remove from the cloud too
imager.remove(files, function (err) {
if (err) return next(err);
}, 'article');
next();
});
I'm not sure how this is supposed to work, however when updating an article by re-uploading the image, the old image does not get removed from S3. I guess article.js is missing a
pre('update')
similar to the remove hook, but only ifreq.files.image===true
?