diff --git a/src/controllers/submitUrlController.js b/src/controllers/submitUrlController.js index d83763ac..e3648034 100644 --- a/src/controllers/submitUrlController.js +++ b/src/controllers/submitUrlController.js @@ -157,8 +157,9 @@ class SubmitUrlController extends UploadController { if (!response) { return false } + try { - return (response.status >= 200 && response.status < 300) || response.status === 400 // need to add 400 as some servers return 400 for head requests + return response.status !== 404 // Allow everything except 404, we cannot be sure what the server will return for HEAD requests } catch (err) { logger.warn(err) return true diff --git a/test/unit/submitUrlController.test.js b/test/unit/submitUrlController.test.js index 24fb7467..8e06b5f7 100644 --- a/test/unit/submitUrlController.test.js +++ b/test/unit/submitUrlController.test.js @@ -188,8 +188,8 @@ describe('SubmitUrlController', async () => { expect(SubmitUrlController.isUrlAccessible({ status: 200 })).toBe(true) }) - it('should return false for URLs that exist with a 3XX status code', async () => { - expect(SubmitUrlController.isUrlAccessible({ status: 301 })).toBe(false) + it('should return true for URLs that exist with a 3XX status code', async () => { + expect(SubmitUrlController.isUrlAccessible({ status: 301 })).toBe(true) }) it('should return false for URLs that exist with a 4XX status code', async () => {