diff options
Diffstat (limited to 'bucky/db/index.js')
| -rw-r--r-- | bucky/db/index.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bucky/db/index.js b/bucky/db/index.js index 350f2a4..935219f 100644 --- a/bucky/db/index.js +++ b/bucky/db/index.js @@ -156,16 +156,20 @@ db.moveFile = function(file, thread_id){ var s3client = upload.client() var srcPath = '/bucky/data/' + file.get('thread') + '/' + file.get('filename') var destPath = '/bucky/data/' + thread_id + '/' + file.get('filename') + console.log('moving', srcPath, 'to', destPath) var copyPromise = new Promise((resolve, reject) => { s3client.copy(srcPath, destPath).on('response', function(res){ + console.log('copied file') s3client.deleteFile(srcPath, function(err, res){ if (err) { + console.log('error deleting file') return reject(err) } file.set('thread', thread_id) file.save().then(() => { resolve() }).catch(err => { + console.log('error saving file') reject(err) }) }) |
