Skip to content

Commit

Permalink
Merge branch 'master' into content-api-img
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanvds-kov committed Jun 8, 2021
2 parents 5a0badf + 2942df6 commit d597bac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
npm-debug.log
.idea
*.swp
.vscode
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The examples below are assumed from am `/activities` API
s3bucket: process.env.S3_BUCKET,
s3region: 'eu-central-1',
maxRetries: 3,
createBucketIfNotExists: true //optional, if true, creates the bucket if it doesnt exist yet.
createBucketIfNotExists: true, //optional, if true, creates the bucket if it doesnt exist yet.
checkFileExistence: true // optional, checks if the file already exists in s3
});
//
// Then pass the attachments plugin with your resource
Expand Down
9 changes: 6 additions & 3 deletions js/sri4node-attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ exports = module.exports = {
maximumFilesizeInMB: 10,
verbose: false,
createBucketIfNotExists: false,
handleMultipleUploadsTogether: false
handleMultipleUploadsTogether: false,
checkFileExistence: true
};
objectMerge(configuration, config);

Expand Down Expand Up @@ -243,7 +244,7 @@ exports = module.exports = {

}

async function checkExistance(files, sriRequest) {
async function checkExistence(files, sriRequest) {

for (let fileWithJson of files) {
//console.log(params);
Expand Down Expand Up @@ -681,7 +682,9 @@ exports = module.exports = {

});

await checkExistance(bodyJson.filter(e => e.file !== undefined), sriRequest);
if (config.checkFileExistence) {
await checkExistence(bodyJson.filter(e => e.file !== undefined), sriRequest);
}

//add uploads to the queue
if (!config.handleMultipleUploadsTogether) {
Expand Down

0 comments on commit d597bac

Please sign in to comment.