@@ -12,6 +12,7 @@ export default class AvailableSecurityFixesGlobalCheck {
1212 OUTDATED_VERSION : "A new version of Electron is available" } ;
1313 this . depends = [ "ElectronVersionJSONCheck" ] ;
1414 this . releaseNoteSecurityFixRegex = [ / # S e c u r i t y / i, / \[ s e c u r i t y \] / i ] ;
15+ this . githubEtagRegex = / [ 0 - 9 a - f ] { 40 } / g;
1516 }
1617
1718 async perform ( issues ) {
@@ -82,7 +83,11 @@ export default class AvailableSecurityFixesGlobalCheck {
8283 return false ;
8384 }
8485 var rawRemoteEtag = ElectronReleaseData . headers . etag ;
85- remoteEtag = rawRemoteEtag . substring ( 1 , rawRemoteEtag . length - 1 ) ;
86+ remoteEtag = rawRemoteEtag . match ( this . githubEtagRegex ) ;
87+ if ( remoteEtag == null ) {
88+ console . log ( chalk . yellow ( `Something went wrong while fetching Electron's releases. Etag returned from Github was not recognized.` ) ) ;
89+ return false ;
90+ } else remoteEtag = remoteEtag [ 0 ] ;
8691 localEtag = releaseFile [ 0 ] . split ( '.' ) [ 1 ] ;
8792
8893 //check if it corresponds to our local version
@@ -109,7 +114,11 @@ export default class AvailableSecurityFixesGlobalCheck {
109114 }
110115 var latest = ElectronReleaseData . body . filter ( a => a . npm_dist_tags [ 0 ] === "latest" ) [ 0 ] . tag_name ;
111116 var rawRemoteEtag = ElectronReleaseData . headers . etag ;
112- remoteEtag = rawRemoteEtag . substring ( 1 , rawRemoteEtag . length - 1 ) ;
117+ remoteEtag = rawRemoteEtag . match ( this . githubEtagRegex ) ;
118+ if ( remoteEtag == null ) {
119+ console . log ( chalk . yellow ( `Something went wrong while fetching Electron's releases. Etag returned from Github was not recognized.` ) ) ;
120+ return false ;
121+ } else remoteEtag = remoteEtag [ 0 ] ;
113122 var outputFileContent = [ ] ;
114123 for ( let release of ElectronReleaseData . body ) {
115124 let essentialInfo = { } ;
0 commit comments