Skip to content

Commit e681b55

Browse files
committed
Fix crash when AWS credentials are present outside of environment vars.
1 parent a84f03c commit e681b55

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

utils/files/remoteFiles.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const fs = require('fs')
33
const cp = require('child_process')
44
const Issue = require('../issues').Issue
55
const zlib = require('zlib')
6-
const s3 = new AWS.S3()
76
const isNode = typeof window === 'undefined'
87

98
/**
@@ -82,6 +81,7 @@ const remoteFiles = {
8281
? Object.keys(process.env).indexOf('AWS_ACCESS_KEY_ID') > -1
8382
: false
8483
if (hasCreds) {
84+
const s3 = new AWS.S3()
8585
return s3
8686
.getObject(config.s3Params)
8787
.promise()
@@ -104,11 +104,9 @@ const remoteFiles = {
104104

105105
constructAwsUrl: function(config) {
106106
// bucket + key url
107-
let url =
108-
s3.getSignedUrl('getObject', config.s3Params) +
109-
config.s3Params.Bucket +
110-
'/' +
107+
let url = `http://s3.amazonaws.com/${config.s3Params.Bucket}/${
111108
config.s3Params.Key
109+
}`
112110

113111
// add version to url, if exists
114112
url = config.s3Params.VersionId

0 commit comments

Comments
 (0)