From c9d82e13bd6b2815ac59afff8b79cd3887109787 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 27 Nov 2018 16:51:47 -0500 Subject: [PATCH] Token handling, better S3 test uploads --- libs/Task.js | 16 ++++++++++------ public/js/main.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libs/Task.js b/libs/Task.js index a6666c9..157c6e6 100644 --- a/libs/Task.js +++ b/libs/Task.js @@ -218,10 +218,6 @@ module.exports = class Task{ this.stopTrackingProcessingTime(); done(err); }; - - const sourcePath = !config.test ? - this.getProjectFolderPath() : - path.join("tests", "processing_results"); const postProcess = () => { const createZipArchive = (outputFilename, files) => { @@ -242,7 +238,11 @@ module.exports = class Task{ }); archive.pipe(output); - let globs = []; + let globs = []; + + const sourcePath = !config.test ? + this.getProjectFolderPath() : + path.join("tests", "processing_results"); // Process files and directories first files.forEach(file => { @@ -342,7 +342,11 @@ module.exports = class Task{ // Upload to S3 all paths + all.zip file (if config says so) if (S3.enabled()){ tasks.push((done) => { - S3.uploadPaths(sourcePath, config.s3Bucket, this.uuid, ['all.zip'].concat(allPaths), + const s3Paths = !config.test ? + ['all.zip'].concat(allPaths) : + ['all.zip']; // During testing only upload all.zip + + S3.uploadPaths(this.getProjectFolderPath(), config.s3Bucket, this.uuid, s3Paths, err => { if (!err) this.output.push("Done uploading to S3!"); done(err); diff --git a/public/js/main.js b/public/js/main.js index 9cead12..dabf1e2 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -211,7 +211,7 @@ $(function() { }; Task.prototype.remove = function() { var self = this; - var url = "/task/remove"; + var url = "/task/remove?token=" + token; function doRemove() { $.post(url, {