Skip to content

Commit d2498eb

Browse files
committed
fix(download): fix other instances of s3 downloads
refs #190
1 parent 52efd96 commit d2498eb

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

lib/editor/actions/snapshots.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {createAction} from 'redux-actions'
33
import {secureFetch} from '../../common/actions'
44
import {getConfigProperty} from '../../common/util/config'
55
import {handleJobResponse} from '../../manager/actions/status'
6-
import {downloadS3Key} from '../../manager/actions/versions'
76

87
const requestingSnapshots = createAction('REQUESTING_GTFSEDITOR_SNAPSHOTS')
98
const receiveSnapshots = createAction('RECEIVE_GTFSEDITOR_SNAPSHOTS')
@@ -60,12 +59,13 @@ export function downloadSnapshotViaCredentials (snapshot, isPublic, prefix) {
6059
const url = `/api/editor/${route}/snapshot/${snapshot.id}/downloadtoken?feedId=${snapshot.feedSourceId}`
6160
return dispatch(secureFetch(url))
6261
.then(response => response.json())
63-
.then(credentials => {
62+
.then(json => {
6463
if (getConfigProperty('application.data.use_s3_storage')) {
65-
dispatch(downloadS3Key(credentials, `${snapshot.id}.zip`, 'snapshots'))
64+
// Download object using presigned S3 URL.
65+
window.location.assign(json.url)
6666
} else {
67-
// use token to download feed
68-
window.location.assign(`/api/editor/downloadsnapshot/${credentials.id}`)
67+
// Use token to download feed
68+
window.location.assign(`/api/editor/downloadsnapshot/${json.id}`)
6969
}
7070
})
7171
}

lib/manager/actions/projects.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,16 @@ export function downloadMergedFeedViaToken (project, isPublic, prefix) {
194194
return function (dispatch, getState) {
195195
const route = isPublic ? 'public' : 'secure'
196196
const url = `/api/manager/${route}/project/${project.id}/downloadtoken`
197-
dispatch(secureFetch(url))
198-
.then(response => response.json())
199-
.then(credentials => {
200-
if (getConfigProperty('application.data.use_s3_storage')) {
201-
dispatch(downloadS3Key(credentials, `${project.id}.zip`, 'project'))
202-
} else {
203-
// use token to download feed
204-
window.location.assign(`/api/manager/downloadprojectfeed/${credentials.id}`)
205-
}
206-
})
197+
return dispatch(secureFetch(url))
198+
.then(response => response.json())
199+
.then(json => {
200+
if (getConfigProperty('application.data.use_s3_storage')) {
201+
// Download object using presigned S3 URL.
202+
window.location.assign(json.url)
203+
} else {
204+
// use token to download feed
205+
window.location.assign(`/api/manager/downloadprojectfeed/${json.id}`)
206+
}
207+
})
207208
}
208209
}

lib/manager/actions/versions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export function downloadFeedViaToken (feedVersion, isPublic, prefix = 'gtfs') {
369369
.then(response => response.json())
370370
.then(json => {
371371
if (getConfigProperty('application.data.use_s3_storage')) {
372-
// Download object using presigned URL.
372+
// Download object using presigned S3 URL.
373373
window.location.assign(json.url)
374374
} else {
375375
// Otherwise, use the provided token to download feed from the server.

0 commit comments

Comments
 (0)