diff --git a/lib/editor/actions/snapshots.js b/lib/editor/actions/snapshots.js index 0d6a00738..a73a81ca1 100644 --- a/lib/editor/actions/snapshots.js +++ b/lib/editor/actions/snapshots.js @@ -3,7 +3,6 @@ import {createAction} from 'redux-actions' import {secureFetch} from '../../common/actions' import {getConfigProperty} from '../../common/util/config' import {handleJobResponse} from '../../manager/actions/status' -import {downloadS3Key} from '../../manager/actions/versions' const requestingSnapshots = createAction('REQUESTING_GTFSEDITOR_SNAPSHOTS') const receiveSnapshots = createAction('RECEIVE_GTFSEDITOR_SNAPSHOTS') @@ -60,12 +59,13 @@ export function downloadSnapshotViaCredentials (snapshot, isPublic, prefix) { const url = `/api/editor/${route}/snapshot/${snapshot.id}/downloadtoken?feedId=${snapshot.feedSourceId}` return dispatch(secureFetch(url)) .then(response => response.json()) - .then(credentials => { + .then(json => { if (getConfigProperty('application.data.use_s3_storage')) { - dispatch(downloadS3Key(credentials, `${snapshot.id}.zip`, 'snapshots')) + // Download object using presigned S3 URL. + window.location.assign(json.url) } else { - // use token to download feed - window.location.assign(`/api/editor/downloadsnapshot/${credentials.id}`) + // Use token to download feed + window.location.assign(`/api/editor/downloadsnapshot/${json.id}`) } }) } diff --git a/lib/manager/actions/projects.js b/lib/manager/actions/projects.js index 90f8c372e..4dc8b5af1 100644 --- a/lib/manager/actions/projects.js +++ b/lib/manager/actions/projects.js @@ -194,15 +194,16 @@ export function downloadMergedFeedViaToken (project, isPublic, prefix) { return function (dispatch, getState) { const route = isPublic ? 'public' : 'secure' const url = `/api/manager/${route}/project/${project.id}/downloadtoken` - dispatch(secureFetch(url)) - .then(response => response.json()) - .then(credentials => { - if (getConfigProperty('application.data.use_s3_storage')) { - dispatch(downloadS3Key(credentials, `${project.id}.zip`, 'project')) - } else { - // use token to download feed - window.location.assign(`/api/manager/downloadprojectfeed/${credentials.id}`) - } - }) + return dispatch(secureFetch(url)) + .then(response => response.json()) + .then(json => { + if (getConfigProperty('application.data.use_s3_storage')) { + // Download object using presigned S3 URL. + window.location.assign(json.url) + } else { + // use token to download feed + window.location.assign(`/api/manager/downloadprojectfeed/${json.id}`) + } + }) } } diff --git a/lib/manager/actions/versions.js b/lib/manager/actions/versions.js index 0010aafc3..0f838caa9 100644 --- a/lib/manager/actions/versions.js +++ b/lib/manager/actions/versions.js @@ -369,7 +369,7 @@ export function downloadFeedViaToken (feedVersion, isPublic, prefix = 'gtfs') { .then(response => response.json()) .then(json => { if (getConfigProperty('application.data.use_s3_storage')) { - // Download object using presigned URL. + // Download object using presigned S3 URL. window.location.assign(json.url) } else { // Otherwise, use the provided token to download feed from the server.