diff --git a/config/default.js b/config/default.js index 1e4f3b5492..eec7c888a2 100644 --- a/config/default.js +++ b/config/default.js @@ -116,6 +116,7 @@ module.exports = { FORUMS_VANILLA: 'https://vanilla.topcoder-dev.com', HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles', SUBMISSION_REVIEW: 'https://submission-review.topcoder-dev.com', + SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder-dev.com', THRIVE: 'https://community-app.topcoder-dev.com/thrive', diff --git a/config/production.js b/config/production.js index 6f068449ec..25e837026c 100644 --- a/config/production.js +++ b/config/production.js @@ -35,6 +35,7 @@ module.exports = { FORUMS_VANILLA: 'https://discussions.topcoder.com', HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles', SUBMISSION_REVIEW: 'https://submission-review.topcoder.com', + SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder.com', MEMBER: 'https://member.topcoder.com', ONLINE_REVIEW: 'https://software.topcoder.com', PAYMENT_TOOL: 'https://payment.topcoder.com', diff --git a/src/shared/containers/SubmissionManagement/index.jsx b/src/shared/containers/SubmissionManagement/index.jsx index 0e7869781d..7ecc153b6f 100644 --- a/src/shared/containers/SubmissionManagement/index.jsx +++ b/src/shared/containers/SubmissionManagement/index.jsx @@ -15,13 +15,11 @@ import PT from 'prop-types'; import { connect } from 'react-redux'; import { Modal } from 'topcoder-react-ui-kit'; import { config } from 'topcoder-react-utils'; -import { actions, services } from 'topcoder-react-lib'; +import { actions } from 'topcoder-react-lib'; import './styles.scss'; import smpActions from '../../actions/page/submission_management'; -const { getService } = services.submissions; - // The container component class SubmissionManagementPageContainer extends React.Component { componentDidMount() { @@ -70,17 +68,16 @@ class SubmissionManagementPageContainer extends React.Component { onShowDetails, onDelete: onSubmissionDelete, onDownload: (challengeType, submissionId) => { - const submissionsService = getService(authTokens.tokenV3); - submissionsService.downloadSubmission(submissionId) - .then((blob) => { - const url = window.URL.createObjectURL(new Blob([blob])); - const link = document.createElement('a'); - link.href = url; - link.setAttribute('download', `submission-${challengeType}-${submissionId}.zip`); - document.body.appendChild(link); - link.click(); - link.parentNode.removeChild(link); - }); + // download large file using stream method + const downloadSubmissionURL = `${config.URL.SUBMISSION_REVIEW_API_URL}/challengeSubmissions/${submissionId}/download?token=${authTokens.tokenV3}`; + + const link = document.createElement('a'); + link.href = downloadSubmissionURL; + link.setAttribute('download', `submission-${challengeType}-${submissionId}.zip`); + + document.body.appendChild(link); + link.click(); + link.parentNode.removeChild(link); }, onlineReviewUrl: `${config.URL.ONLINE_REVIEW}/review/actions/ViewProjectDetails?pid=${challengeId}`, challengeUrl: `${challengesUrl}/${challengeId}`,