Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 45ddb28

Browse files
committed
Check status code before following a redirection
1 parent 7a01fdd commit 45ddb28

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/url-add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const requestWithRedirect = (url, opts, send, callback) => {
4646

4747
const redirection = res.headers.location
4848

49-
if (redirection) {
49+
if (res.statusCode >= 300 && res.statusCode < 400 && redirection) {
5050
if (!validUrl(redirection)) {
5151
return callback(new Error('redirection url must be an http(s) url'))
5252
}

0 commit comments

Comments
 (0)