diff --git a/src/index.coffee b/src/index.coffee index 1441a77..4868653 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -43,7 +43,11 @@ Upload = module.exports = (awsBucketName, @opts = {}) -> @opts.tmpPrefix ?= 'gm-' @opts.workers ?= 1 - @opts.url ?= "https://s3-#{@opts.aws.region}.amazonaws.com/#{@opts.aws.params.Bucket}/" + + if not @opts.url and @opts.aws.region is 'us-east-1' + @opts.url ?= "https://s3.amazonaws.com/#{@opts.aws.params.Bucket}/" + else if not @opts.url + @opts.url ?= "https://s3-#{@opts.aws.region}.amazonaws.com/#{@opts.aws.params.Bucket}/" @s3 = new S3 @opts.aws diff --git a/test/suite.coffee b/test/suite.coffee index 95e8bed..f93e0bd 100644 --- a/test/suite.coffee +++ b/test/suite.coffee @@ -83,7 +83,7 @@ describe 'Upload', -> assert.equal upload.opts.tmpPrefix, 'gm-' assert.equal upload.opts.workers, 1 - assert.equal upload.opts.url, 'https://s3-us-east-1.amazonaws.com/myBucket/' + assert.equal upload.opts.url, 'https://s3.amazonaws.com/myBucket/' it 'should set deprecated options correctly', -> upload = new Upload 'myBucket',