mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-27 10:18:25 +08:00
Log invalid magic's
This commit is contained in:
parent
ee4a76e30e
commit
c13cd6b1c3
3 changed files with 14 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
const GridFSBucket = require('mongodb').GridFSBucket;
|
||||
const libbase64 = require('libbase64');
|
||||
const errors = require('../errors');
|
||||
|
||||
// Set to false to disable base64 decoding feature
|
||||
const FEATURE_DECODE_ATTACHMENTS = true;
|
||||
|
@ -50,6 +51,10 @@ class GridstoreStorage {
|
|||
transferEncoding: attachment.transferEncoding
|
||||
};
|
||||
|
||||
if (!isNaN(metadata.m)) {
|
||||
errors.notify(new Error('Invalid magic "' + metadata.m + '" for ' + id));
|
||||
}
|
||||
|
||||
Object.keys(attachment.metadata || {}).forEach(key => {
|
||||
if (!(key in attachment.metadata)) {
|
||||
metadata[key] = attachment.metadata[key];
|
||||
|
@ -193,6 +198,9 @@ class GridstoreStorage {
|
|||
}
|
||||
|
||||
delete(id, magic, callback) {
|
||||
if (!isNaN(magic)) {
|
||||
errors.notify(new Error('Invalid magic "' + magic + '" for ' + id));
|
||||
}
|
||||
this.gridfs.collection(this.bucketName + '.files').findOneAndUpdate({
|
||||
_id: id
|
||||
}, {
|
||||
|
@ -231,6 +239,9 @@ class GridstoreStorage {
|
|||
}
|
||||
|
||||
update(ids, count, magic, callback) {
|
||||
if (!isNaN(magic)) {
|
||||
errors.notify(new Error('Invalid magic "' + magic + '" for ' + ids));
|
||||
}
|
||||
// update attachments
|
||||
this.gridfs.collection(this.bucketName + '.files').updateMany(
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint global-require: 0 */
|
||||
/* eslint global-require: 0, no-console: 0 */
|
||||
'use strict';
|
||||
|
||||
const config = require('wild-config');
|
||||
|
@ -12,5 +12,7 @@ if (config.bugsnagCode) {
|
|||
module.exports.notify = (...args) => {
|
||||
if (bugsnag) {
|
||||
bugsnag.notify(...args);
|
||||
} else {
|
||||
console.error(...args);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,8 +19,6 @@ const packageData = require('./package.json');
|
|||
log.level = config.log.level;
|
||||
require('./logger');
|
||||
|
||||
errors.notify(new Error('Starting mail server application'));
|
||||
|
||||
const printLogo = () => {
|
||||
let logo = fs
|
||||
.readFileSync(__dirname + '/logo.txt', 'utf-8')
|
||||
|
|
Loading…
Reference in a new issue