diff --git a/.circleci/config.yml b/.circleci/config.yml index d259b85b7..4b1904184 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -179,6 +179,7 @@ workflows: branches: only: - develop + - PM-3087_virus-scan-fix - "build-prod": context: org-global diff --git a/src/shared/components/SubmissionManagement/Submission/index.jsx b/src/shared/components/SubmissionManagement/Submission/index.jsx index 2c15defb4..903bc7cc1 100644 --- a/src/shared/components/SubmissionManagement/Submission/index.jsx +++ b/src/shared/components/SubmissionManagement/Submission/index.jsx @@ -46,7 +46,7 @@ export default function Submission(props) { } = props; const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A'); const onDownloadSubmission = onDownload.bind(1, submissionObject.id); - const safeForDownloadCheck = safeForDownload(submissionObject.url); + const safeForDownloadCheck = safeForDownload(submissionObject); const onDownloadArtifacts = onOpenDownloadArtifactsModal.bind(1, submissionObject.id); const onOpenRatingsList = onOpenRatingsListModal.bind(1, submissionObject.id); const onOpenReviewApp = () => { diff --git a/src/shared/containers/SubmissionManagement/index.jsx b/src/shared/containers/SubmissionManagement/index.jsx index 3a05e7369..91fe8117e 100644 --- a/src/shared/containers/SubmissionManagement/index.jsx +++ b/src/shared/containers/SubmissionManagement/index.jsx @@ -192,7 +192,7 @@ class SubmissionManagementPageContainer extends React.Component { const { needReload } = this.state; if (needReload === false && mySubmissions) { - if (mySubmissions.find(item => safeForDownload(item.url) !== true)) { + if (mySubmissions.find(item => safeForDownload(item) !== true)) { this.setState({ needReload: true }); setTimeout(() => { loadMySubmissions(authTokens, challengeId); diff --git a/src/shared/utils/tc.js b/src/shared/utils/tc.js index 0b1f3f3d7..d40eef66c 100644 --- a/src/shared/utils/tc.js +++ b/src/shared/utils/tc.js @@ -376,21 +376,20 @@ export function isValidEmail(email) { } /** - * Test if the file is safe for download. This patch currently checks the location of the submission - * to determine if the file is infected or not. This is an immedaite patch, and should be updated to - * check the review scan score for review type virus scan. + * Test if the file is safe for download. This function can accept the full submission object. * * @returns {String|Boolean} true if submission is safe for download, * otherwise string describing reason for not being safe for download */ -export function safeForDownload(url) { - if (url == null) return 'Download link unavailable'; +export function safeForDownload(submission) { + if (submission == null || !submission.url) return 'Download link unavailable'; - if (url.toLowerCase().indexOf('submissions-quarantine/') !== -1) { + const { url } = submission; + if (url.toLowerCase().indexOf('submissions-quarantine/') !== -1 || submission.virusScan === false) { return 'Malware found in submission'; } - if (url.toLowerCase().indexOf('submissions-dmz/') !== -1) { + if (url.toLowerCase().indexOf('submissions-dmz/') !== -1 || !submission.virusScan) { return 'AV Scan in progress'; }