From bb5c1053832e8882d16d6104c28be69b4067b0eb Mon Sep 17 00:00:00 2001 From: kannappanr <30541348+kannappanr@users.noreply.github.com> Date: Wed, 17 Jan 2018 02:20:42 -0800 Subject: [PATCH] Remove IsAmazonEndpoint check in IsValidEndpoint (#664) This is done to support all Amazon endpoints. --- src/main/helpers.js | 6 ------ src/test/unit/test.js | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/helpers.js b/src/main/helpers.js index 9cc13aee..ebf327b6 100644 --- a/src/main/helpers.js +++ b/src/main/helpers.js @@ -112,12 +112,6 @@ export function isValidEndpoint(endpoint) { if (!isValidDomain(endpoint) && !isValidIP(endpoint)) { return false } - // Endpoint matches amazon, make sure its 's3.amazonaws.com' - if (endpoint.match('.amazonaws.com$') || endpoint.match('.amazonaws.com.cn$')) { - if (!isAmazonEndpoint(endpoint)) { - return false - } - } // Return true. return true } diff --git a/src/test/unit/test.js b/src/test/unit/test.js index 55e022de..de83c97e 100644 --- a/src/test/unit/test.js +++ b/src/test/unit/test.js @@ -33,8 +33,8 @@ describe('Helpers', () => { it('should validate for s3 china', () => { assert.equal(isValidEndpoint('s3.cn-north-1.amazonaws.com.cn'), true) }) - it('should fail for invalid endpoint', () => { - assert.equal(isValidEndpoint('s3-us-west-2.amazonaws.com'), false) + it('should validate for us-west-2', () => { + assert.equal(isValidEndpoint('s3-us-west-2.amazonaws.com'), true) }) it('should fail for invalid endpoint characters', () => { assert.equal(isValidEndpoint('111.#2.11'), false)