@@ -15,13 +15,11 @@ import PT from 'prop-types';
1515import { connect } from 'react-redux' ;
1616import { Modal } from 'topcoder-react-ui-kit' ;
1717import { config } from 'topcoder-react-utils' ;
18- import { actions , services } from 'topcoder-react-lib' ;
18+ import { actions } from 'topcoder-react-lib' ;
1919
2020import './styles.scss' ;
2121import smpActions from '../../actions/page/submission_management' ;
2222
23- const { getService } = services . submissions ;
24-
2523// The container component
2624class SubmissionManagementPageContainer extends React . Component {
2725 componentDidMount ( ) {
@@ -70,17 +68,16 @@ class SubmissionManagementPageContainer extends React.Component {
7068 onShowDetails,
7169 onDelete : onSubmissionDelete ,
7270 onDownload : ( challengeType , submissionId ) => {
73- const submissionsService = getService ( authTokens . tokenV3 ) ;
74- submissionsService . downloadSubmission ( submissionId )
75- . then ( ( blob ) => {
76- const url = window . URL . createObjectURL ( new Blob ( [ blob ] ) ) ;
77- const link = document . createElement ( 'a' ) ;
78- link . href = url ;
79- link . setAttribute ( 'download' , `submission-${ challengeType } -${ submissionId } .zip` ) ;
80- document . body . appendChild ( link ) ;
81- link . click ( ) ;
82- link . parentNode . removeChild ( link ) ;
83- } ) ;
71+ // download large file using stream method
72+ const downloadSubmissionURL = `${ config . URL . SUBMISSION_REVIEW_API_URL } /challengeSubmissions/${ submissionId } /download?token=${ authTokens . tokenV3 } ` ;
73+
74+ const link = document . createElement ( 'a' ) ;
75+ link . href = downloadSubmissionURL ;
76+ link . setAttribute ( 'download' , `submission-${ challengeType } -${ submissionId } .zip` ) ;
77+
78+ document . body . appendChild ( link ) ;
79+ link . click ( ) ;
80+ link . parentNode . removeChild ( link ) ;
8481 } ,
8582 onlineReviewUrl : `${ config . URL . ONLINE_REVIEW } /review/actions/ViewProjectDetails?pid=${ challengeId } ` ,
8683 challengeUrl : `${ challengesUrl } /${ challengeId } ` ,
0 commit comments