File tree 6 files changed +40
-8
lines changed
6 files changed +40
-8
lines changed Original file line number Diff line number Diff line change @@ -143,8 +143,20 @@ const fetch = async (url, opts) => {
143
143
const location = headers . get ( 'Location' )
144
144
145
145
// HTTP fetch step 5.3
146
- const locationURL = location === null ? null
147
- : ( new URL ( location , request . url ) ) . toString ( )
146
+ let locationURL = null
147
+ try {
148
+ locationURL = location === null ? null : new URL ( location , request . url ) . toString ( )
149
+ } catch {
150
+ // error here can only be invalid URL in Location: header
151
+ // do not throw when options.redirect == manual
152
+ // let the user extract the errorneous redirect URL
153
+ if ( request . redirect !== 'manual' ) {
154
+ /* eslint-disable-next-line max-len */
155
+ reject ( new FetchError ( `uri requested responds with an invalid redirect URL: ${ location } ` , 'invalid-redirect' ) )
156
+ finalize ( )
157
+ return
158
+ }
159
+ }
148
160
149
161
// HTTP fetch step 5.5
150
162
if ( request . redirect === 'error' ) {
Original file line number Diff line number Diff line change @@ -265,6 +265,7 @@ class Request extends Body {
265
265
secureProtocol,
266
266
servername,
267
267
sessionIdContext,
268
+ timeout : request . timeout ,
268
269
}
269
270
}
270
271
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " minipass-fetch" ,
3
- "version" : " 3.0.1 " ,
3
+ "version" : " 3.0.2 " ,
4
4
"description" : " An implementation of window.fetch in Node.js using Minipass streams" ,
5
5
"license" : " MIT" ,
6
6
"main" : " lib/index.js" ,
24
24
},
25
25
"devDependencies" : {
26
26
"@npmcli/eslint-config" : " ^4.0.0" ,
27
- "@npmcli/template-oss" : " 4.10 .0" ,
27
+ "@npmcli/template-oss" : " 4.13 .0" ,
28
28
"@ungap/url-search-params" : " ^0.2.2" ,
29
29
"abort-controller" : " ^3.0.0" ,
30
30
"abortcontroller-polyfill" : " ~1.7.3" ,
63
63
"author" : " GitHub Inc." ,
64
64
"templateOSS" : {
65
65
"//@npmcli/template-oss" : " This file is partially managed by @npmcli/template-oss. Edits may be overwritten." ,
66
- "version" : " 4.10.0"
66
+ "version" : " 4.13.0" ,
67
+ "publish" : " true"
67
68
}
68
69
}
Original file line number Diff line number Diff line change
1
+ # Names sorted by how much code was originally theirs.
2
+ Isaac Z. Schlueter <i@izs.me>
3
+ Meryn Stol <merynstol@gmail.com>
4
+ Robert Kowalski <rok@kowalski.gd>
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3
+ exports . join = void 0 ;
4
+ const url_1 = require ( "url" ) ;
5
+ function join ( base , path ) {
6
+ return new url_1 . URL ( ensureTrailingSlash ( base ) + removeLeadingSlash ( path ) ) . toString ( ) ;
7
+ }
8
+ exports . join = join ;
9
+ function ensureTrailingSlash ( path ) {
10
+ return path . endsWith ( '/' ) ? path : path + '/' ;
11
+ }
12
+ function removeLeadingSlash ( path ) {
13
+ return path . startsWith ( '/' ) ? path . slice ( 1 ) : path ;
14
+ }
Original file line number Diff line number Diff line change 8581
8581
}
8582
8582
},
8583
8583
"node_modules/minipass-fetch": {
8584
- "version": "3.0.1 ",
8585
- "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.1 .tgz",
8586
- "integrity": "sha512-t9/wowtf7DYkwz8cfMSt0rMwiyNIBXf5CKZ3S5ZMqRqMYT0oLTp0x1WorMI9WTwvaPg21r1JbFxJMum8JrLGfw ==",
8584
+ "version": "3.0.2 ",
8585
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2 .tgz",
8586
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA ==",
8587
8587
"inBundle": true,
8588
8588
"dependencies": {
8589
8589
"minipass": "^4.0.0",
You can’t perform that action at this time.
0 commit comments