@@ -54,7 +55,7 @@ export default function Submission(props) {
{
track === COMPETITION_TRACKS.DES && (
- {submissionObject.screening
+ {safeForDownloadCheck !== true ? safeForDownloadCheck : submissionObject.screening
&& (
onDownloadSubmission(submissionObject.id)}
type="button"
>
-
+ { safeForDownloadCheck === true && }
{ /*
TODO: At the moment we just fetch downloads from the legacy
@@ -127,6 +128,7 @@ Submission.propTypes = {
type: PT.string,
created: PT.any,
download: PT.any,
+ url: PT.string,
}),
showScreeningDetails: PT.bool,
track: PT.string.isRequired,
diff --git a/src/shared/utils/tc.js b/src/shared/utils/tc.js
index 37514bc606..6edfd72a1c 100644
--- a/src/shared/utils/tc.js
+++ b/src/shared/utils/tc.js
@@ -305,4 +305,26 @@ export function isValidEmail(email) {
return pattern.test(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.
+ *
+ * @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';
+
+ if (url.toLowerCase().indexOf('submissions-quarantine/') !== -1) {
+ return 'Malware found in submission';
+ }
+
+ if (url.toLowerCase().indexOf('submissions-dmz/') !== -1) {
+ return 'AV Scan in progress';
+ }
+
+ return true;
+}
+
export default undefined;
|