Skip to content

Commit 497d801

Browse files
committed
Fix GitHub hostname to avoid redirects
Thanks to @AlecRust suggestion in #304. Fixes #317 .
1 parent 895d6b2 commit 497d801

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

src/js/components/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class Sidebar extends React.Component<IProps> {
135135
}
136136

137137
onOpenBrowser() {
138-
shell.openExternal(`https://www.github.com/${Constants.REPO_SLUG}`);
138+
shell.openExternal(`https://github.com/${Constants.REPO_SLUG}`);
139139
}
140140

141141
goToSettings() {

src/js/routes/login.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { ipcRenderer } = require('electron');
33
import * as React from 'react';
44
import { Redirect } from 'react-router-dom';
55
import { connect } from 'react-redux';
6-
import Octicon, { MarkGithub } from '@primer/octicons-react';
76
import styled from 'styled-components';
87

98
import { AppState } from '../../types/reducers';

src/js/utils/helpers.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('utils/helpers.ts', () => {
1616
'https://api.github.com/repos/ekonstantinidis/notifications-test/issues/3';
1717
const newUrl = generateGitHubWebUrl(apiUrl);
1818
expect(newUrl).toBe(
19-
'https://www.github.com/ekonstantinidis/notifications-test/issues/3'
19+
'https://github.com/ekonstantinidis/notifications-test/issues/3'
2020
);
2121
});
2222

@@ -25,17 +25,15 @@ describe('utils/helpers.ts', () => {
2525
'https://api.github.com/repos/ekonstantinidis/notifications-test/pulls/123';
2626
const newUrl = generateGitHubWebUrl(apiUrl);
2727
expect(newUrl).toBe(
28-
'https://www.github.com/ekonstantinidis/notifications-test/pull/123'
28+
'https://github.com/ekonstantinidis/notifications-test/pull/123'
2929
);
3030
});
3131

3232
it('should generate the GitHub url - non enterprise - (release)', () => {
3333
const apiUrl =
3434
'https://api.github.com/repos/myorg/notifications-test/releases/3988077';
3535
const newUrl = generateGitHubWebUrl(apiUrl);
36-
expect(newUrl).toBe(
37-
'https://www.github.com/myorg/notifications-test/releases'
38-
);
36+
expect(newUrl).toBe('https://github.com/myorg/notifications-test/releases');
3937
});
4038

4139
it('should generate the GitHub url - enterprise - (issue)', () => {
@@ -100,7 +98,7 @@ describe('utils/helpers.ts', () => {
10098
(event, callback) => {
10199
if (event === 'will-redirect') {
102100
const event = new Event('will-redirect');
103-
callback(event, 'http://www.github.com/?code=123-456');
101+
callback(event, 'https://github.com/?code=123-456');
104102
}
105103
}
106104
);
@@ -156,7 +154,7 @@ describe('utils/helpers.ts', () => {
156154
(event, callback) => {
157155
if (event === 'did-fail-load') {
158156
const event = new Event('did-fail-load');
159-
callback(event, 500, null, 'http://www.github.com/?code=123-456');
157+
callback(event, 500, null, 'https://github.com/?code=123-456');
160158
}
161159
}
162160
);

src/js/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function generateGitHubWebUrl(url) {
2525

2626
let newUrl = isEnterprise
2727
? url.replace(`${hostname}/api/v3/repos`, hostname)
28-
: url.replace('api.github.com/repos', 'www.github.com');
28+
: url.replace('api.github.com/repos', 'github.com');
2929

3030
if (newUrl.indexOf('/pulls/') !== -1) {
3131
newUrl = newUrl.replace('/pulls/', '/pull/');

0 commit comments

Comments
 (0)