Skip to content

Commit a6e9640

Browse files
authored
Fix issue with case-sensitivity when checking for supported sites (#10)
1 parent bf6bddf commit a6e9640

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/lib/integrations/github.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export class EGithubParseError extends EIntegrationParseError {
2323
}
2424

2525
function isPR(url: string | URL) {
26-
return /[/](?<repo>[^/]+[/][^/]+)([/]?pull[/](\d+))?/.test(url.toString());
26+
return /[/](?<repo>[^/]+[/][^/]+)([/]?pull[/](\d+))?/i.test(url.toString());
2727
}
2828

2929
export const Github: Integration = {
3030
platform: "Github",
3131
supports(url: string | URL) {
32-
return /^https?:[/][/]Github.com[/][^/]+[/][^/]+/.test(url.toString());
32+
return /^https?:[/][/]github.com[/][^/]+[/][^/]+/i.test(url.toString());
3333
},
3434
getButtonTarget(document: Document) {
3535
const node =
@@ -48,7 +48,7 @@ export const Github: Integration = {
4848
},
4949
getRepo({ url }) {
5050
const results =
51-
/[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))?/.exec(
51+
/[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))?/i.exec(
5252
url.toString(),
5353
)?.groups;
5454
if (!results) {
@@ -101,7 +101,7 @@ export const Github: Integration = {
101101
return branch;
102102
} else {
103103
const results =
104-
/[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))/.exec(
104+
/[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))/i.exec(
105105
url.toString(),
106106
)?.groups;
107107
if (!results) {

src/lib/integrations/gitlab.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export class EGitLabParseError extends EIntegrationParseError {
2222
}
2323

2424
function isPR(url: string | URL) {
25-
return /[/][^/]+[/][^/]+[/]-[/]merge_requests[/].+/.test(url.toString());
25+
return /[/][^/]+[/][^/]+[/]-[/]merge_requests[/].+/i.test(url.toString());
2626
}
2727

2828
export const GitLab: Integration = {
2929
platform: "GitLab",
3030
supports(url: string | URL) {
31-
return /^https?:[/][/]gitlab.com[/][^/]+[/][^/]+/.test(url.toString());
31+
return /^https?:[/][/]gitlab.com[/][^/]+[/][^/]+/i.test(url.toString());
3232
},
3333
getButtonTarget(document: Document) {
3434
const node =
@@ -49,7 +49,7 @@ export const GitLab: Integration = {
4949
},
5050
getRepo({ url }) {
5151
const results =
52-
/[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))?/.exec(
52+
/[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))?/i.exec(
5353
url.toString(),
5454
)?.groups;
5555
if (!results) {
@@ -101,7 +101,7 @@ export const GitLab: Integration = {
101101
}
102102
return branch;
103103
} else {
104-
const results = /[/][^/]+[/][^/]+[/]-[/]tree[/](?<branch>[^?]+)/.exec(
104+
const results = /[/][^/]+[/][^/]+[/]-[/]tree[/](?<branch>[^?]+)/i.exec(
105105
url.toString(),
106106
)?.groups;
107107
if (!results) {

0 commit comments

Comments
 (0)