File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
components/SubmissionManagement/Submission Expand file tree Collapse file tree 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) {
3838 } = props ;
3939 const formatDate = date => moment ( + new Date ( date ) ) . format ( 'MMM DD, YYYY hh:mm A' ) ;
4040 const onDownloadSubmission = onDownload . bind ( 1 , submissionObject . id ) ;
41+ const safeForDownloadCheck = safeForDownload ( submissionObject . url ) ;
4142
4243 return (
4344 < tr styleName = "submission-row" >
@@ -54,7 +55,7 @@ export default function Submission(props) {
5455 {
5556 track === COMPETITION_TRACKS . DES && (
5657 < td styleName = "status-col" >
57- { ! safeForDownload ( submissionObject . url ) ? 'Malware found in submission' : submissionObject . screening
58+ { safeForDownloadCheck !== true ? safeForDownloadCheck : submissionObject . screening
5859 && (
5960 < ScreeningStatus
6061 screeningObject = { submissionObject . screening }
@@ -71,7 +72,7 @@ export default function Submission(props) {
7172 onClick = { ( ) => onDownloadSubmission ( submissionObject . id ) }
7273 type = "button"
7374 >
74- { safeForDownload ( submissionObject . url ) && < DownloadIcon /> }
75+ { safeForDownloadCheck === true && < DownloadIcon /> }
7576 </ button >
7677 { /*
7778 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) {
309309 * Test if the file is safe for download. This patch currently checks the location of the submission
310310 * to determine if the file is infected or not. This is an immedaite patch, and should be updated to
311311 * 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
312315 */
313316export 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 ;
315328}
316329
317330export default undefined ;
You can’t perform that action at this time.
0 commit comments