Skip to content

Commit aa896b2

Browse files
author
Dushyant Bhalgami
committed
fixed the issue with the internal artifact download
1 parent b7eb386 commit aa896b2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/services/ArtifactService.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ function * downloadArtifact (submissionId, fileName) {
4646
if (artifacts.Contents.length === 0) {
4747
throw new errors.HttpStatusError(400, `Artifact ${fileName} doesn't exist for ${submissionId}`)
4848
}
49-
const key = fileName + '.zip'
49+
50+
const key = submissionId + '/' + fileName + '.zip'
51+
if (!_.includes(_.map(artifacts.Contents, 'Key'), key)) {
52+
throw new errors.HttpStatusError(400, `Artifact ${fileName} doesn't exist for ${submissionId}`)
53+
}
54+
5055
const downloadedFile = yield s3.getObject({ Bucket: config.aws.ARTIFACT_BUCKET, Key: key }).promise()
5156
// Return the retrieved Artifact
5257
logger.info(`downloadArtifact: returning artifact ${fileName} for Submission ID: ${submissionId}`)

0 commit comments

Comments
 (0)