Skip to content

Commit be0d4b5

Browse files
Merge pull request #6331 from topcoder-platform/revert-6325-feature/download-submission
Revert "fix: issue #5582"
2 parents 6c42073 + ba6abc8 commit be0d4b5

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

config/default.js

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ module.exports = {
116116
FORUMS_VANILLA: 'https://vanilla.topcoder-dev.com',
117117
HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles',
118118
SUBMISSION_REVIEW: 'https://submission-review.topcoder-dev.com',
119-
SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder-dev.com',
120119

121120
THRIVE: 'https://community-app.topcoder-dev.com/thrive',
122121

config/production.js

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ module.exports = {
3535
FORUMS_VANILLA: 'https://discussions.topcoder.com',
3636
HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles',
3737
SUBMISSION_REVIEW: 'https://submission-review.topcoder.com',
38-
SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder.com',
3938
MEMBER: 'https://member.topcoder.com',
4039
ONLINE_REVIEW: 'https://software.topcoder.com',
4140
PAYMENT_TOOL: 'https://payment.topcoder.com',

src/shared/containers/SubmissionManagement/index.jsx

+14-11
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ import PT from 'prop-types';
1515
import { connect } from 'react-redux';
1616
import { Modal } from 'topcoder-react-ui-kit';
1717
import { config } from 'topcoder-react-utils';
18-
import { actions } from 'topcoder-react-lib';
18+
import { actions, services } from 'topcoder-react-lib';
1919

2020
import './styles.scss';
2121
import smpActions from '../../actions/page/submission_management';
2222

23+
const { getService } = services.submissions;
24+
2325
// The container component
2426
class SubmissionManagementPageContainer extends React.Component {
2527
componentDidMount() {
@@ -68,16 +70,17 @@ class SubmissionManagementPageContainer extends React.Component {
6870
onShowDetails,
6971
onDelete: onSubmissionDelete,
7072
onDownload: (challengeType, submissionId) => {
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);
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+
});
8184
},
8285
onlineReviewUrl: `${config.URL.ONLINE_REVIEW}/review/actions/ViewProjectDetails?pid=${challengeId}`,
8386
challengeUrl: `${challengesUrl}/${challengeId}`,

0 commit comments

Comments
 (0)