try moving url if key does not exist
This commit is contained in:
parent
9cf50aa8d5
commit
b45e53483f
1 changed files with 9 additions and 6 deletions
|
@ -55,10 +55,14 @@ Project.count({}).exec().then((numProjects) => {
|
|||
};
|
||||
try {
|
||||
client.moveObject(params)
|
||||
.on('err', (err) => {
|
||||
console.log('in error event function');
|
||||
// console.log(err);
|
||||
.on('error', (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();
|
||||
});
|
||||
})
|
||||
.on('end', () => {
|
||||
file.url = (process.env.S3_BUCKET_URL_BASE ||
|
||||
|
@ -69,8 +73,7 @@ Project.count({}).exec().then((numProjects) => {
|
|||
});
|
||||
});
|
||||
} catch(e) {
|
||||
console.log('in catch function');
|
||||
// console.log(e);
|
||||
console.log(e);
|
||||
fileCb();
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue