try moving url if key does not exist

This commit is contained in:
Cassie Tarakajian 2018-01-08 15:01:43 -05:00
parent 9cf50aa8d5
commit b45e53483f

View file

@ -55,10 +55,14 @@ Project.count({}).exec().then((numProjects) => {
}; };
try { try {
client.moveObject(params) client.moveObject(params)
.on('err', (err) => { .on('error', (err) => {
console.log('in error event function'); console.log(err);
// console.log(err); file.url = (process.env.S3_BUCKET_URL_BASE ||
`https://s3-${process.env.AWS_REGION}.amazonaws.com/${process.env.S3_BUCKET}`) + `/${userId}/${key}`;
project.save((err, savedProject) => {
console.log(`updated file ${key}`);
fileCb(); fileCb();
});
}) })
.on('end', () => { .on('end', () => {
file.url = (process.env.S3_BUCKET_URL_BASE || file.url = (process.env.S3_BUCKET_URL_BASE ||
@ -69,8 +73,7 @@ Project.count({}).exec().then((numProjects) => {
}); });
}); });
} catch(e) { } catch(e) {
console.log('in catch function'); console.log(e);
// console.log(e);
fileCb(); fileCb();
} }
} else { } else {