diff --git a/electron/main-window.ts b/electron/main-window.ts index f88b69385..26c47a1d5 100644 --- a/electron/main-window.ts +++ b/electron/main-window.ts @@ -119,11 +119,7 @@ export const createWindow = ({ // NOTE this is needed for GitHub api requests to work :( // office365 needs a User-Agent as well (#4677) - if ( - !details.url.includes('github.com') && - !details.url.includes('office365.com') && - !details.url.includes('outlook.live.com') - ) { + if (new URL(details.url).hostname in ['github.com', 'office365.com', 'outlook.live.com']) { removeKeyInAnyCase(requestHeaders, 'User-Agent'); } callback({ requestHeaders });