File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ const ping =
4141 Promise . race ( [
4242 fetch ( url , {
4343 method : 'HEAD' ,
44- } ) . then ( ( { status } ) => ( status === 200 ? url : null ) ) ,
44+ } )
45+ . then ( ( { status } ) => ( status === 200 ? url : null ) )
46+ . catch ( ( ) => null ) ,
4547 new Promise ( r => setTimeout ( ( ) => r ( null ) , 2000 ) ) ,
4648 ] ) ;
4749
48- const canUseGoogle = ping ( 'https://www.google.com' ) ;
49-
5050export function joinUrls ( paths : string [ ] , fileName ?: string ) {
5151 if ( fileName ) {
5252 return paths . map ( path => 'https://' + path + '/' + fileName ) ;
@@ -57,8 +57,5 @@ export const testUrls = async (urls?: string[]) => {
5757 if ( ! urls ?. length ) {
5858 return null ;
5959 }
60- if ( await canUseGoogle ) {
61- return urls [ 0 ] ;
62- }
6360 return promiseAny ( urls . map ( ping ) ) . catch ( ( ) => null ) ;
6461} ;
You can’t perform that action at this time.
0 commit comments