File tree 2 files changed +17
-3
lines changed
components/SubmissionManagement/Submission
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export default function Submission(props) {
38
38
} = props ;
39
39
const formatDate = date => moment ( + new Date ( date ) ) . format ( 'MMM DD, YYYY hh:mm A' ) ;
40
40
const onDownloadSubmission = onDownload . bind ( 1 , submissionObject . id ) ;
41
+ const safeForDownloadCheck = safeForDownload ( submissionObject . url ) ;
41
42
42
43
return (
43
44
< tr styleName = "submission-row" >
@@ -54,7 +55,7 @@ export default function Submission(props) {
54
55
{
55
56
track === COMPETITION_TRACKS . DES && (
56
57
< td styleName = "status-col" >
57
- { ! safeForDownload ( submissionObject . url ) ? 'Malware found in submission' : submissionObject . screening
58
+ { safeForDownloadCheck !== true ? safeForDownloadCheck : submissionObject . screening
58
59
&& (
59
60
< ScreeningStatus
60
61
screeningObject = { submissionObject . screening }
@@ -71,7 +72,7 @@ export default function Submission(props) {
71
72
onClick = { ( ) => onDownloadSubmission ( submissionObject . id ) }
72
73
type = "button"
73
74
>
74
- { safeForDownload ( submissionObject . url ) && < DownloadIcon /> }
75
+ { safeForDownloadCheck === true && < DownloadIcon /> }
75
76
</ button >
76
77
{ /*
77
78
TODO: At the moment we just fetch downloads from the legacy
Original file line number Diff line number Diff line change @@ -309,9 +309,22 @@ export function isValidEmail(email) {
309
309
* Test if the file is safe for download. This patch currently checks the location of the submission
310
310
* to determine if the file is infected or not. This is an immedaite patch, and should be updated to
311
311
* check the review scan score for review type virus scan.
312
+ *
313
+ * @returns {String|Boolean } true if submission is safe for download,
314
+ * otherwise string describing reason for not being safe for download
312
315
*/
313
316
export function safeForDownload ( url ) {
314
- return url != null && url . toLowerCase ( ) . indexOf ( 'submissions-quarantine/' ) === - 1 && url . toLowerCase ( ) . indexOf ( 'submissions-dmz/' ) === - 1 ;
317
+ if ( url == null ) return 'Download link unavailable' ;
318
+
319
+ if ( url . toLowerCase ( ) . indexOf ( 'submissions-quarantine/' ) !== - 1 ) {
320
+ return 'Malware found in submission' ;
321
+ }
322
+
323
+ if ( url . toLowerCase ( ) . indexOf ( 'submissions-dmz/' ) === - 1 ) {
324
+ return 'AV Scan in progress' ;
325
+ }
326
+
327
+ return true ;
315
328
}
316
329
317
330
export default undefined ;
You can’t perform that action at this time.
0 commit comments