Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
isPublic = true;
break;
default:
bucket = process.env.private;
break;
}
const p = url.parse(file.stagingFile);
const filename = path.basename(p.path);
log.info(`${filename} copied`, logDetails);
await S3.copy(path.join(p.host, p.path), bucket, filename, isPublic);
// delete the file from staging
const deleteInfo = S3.parseS3Uri(file.stagingFile);
await S3.delete(deleteInfo.Bucket, deleteInfo.Key);
log.info(`${file.stagingFile} deleted`, logDetails);
file.archivedFile = `s3://${bucket}/${filename}`;
file.name = filename;
}
newFiles[key] = file;
}
return newFiles;
}