Skip to content

Commit 9e54e5e

Browse files
committed
Drop protocol check
1 parent 7ec4b4b commit 9e54e5e

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

extensions/ql-vscode/src/common/github-url-identifier-helper.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ function getNwoOrOwnerFromGitHubUrl(
5151
): string | undefined {
5252
try {
5353
const uri = new URL(githubUrl);
54-
if (uri.protocol !== "https:") {
55-
return;
56-
}
5754
if (uri.hostname !== "github.com" && uri.hostname !== "www.github.com") {
5855
return;
5956
}

extensions/ql-vscode/test/unit-tests/common/github-url-identifier-helper.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ describe("github url identifier helper", () => {
2424
describe("getNwoFromGitHubUrl method", () => {
2525
it("should handle invalid urls", () => {
2626
expect(getNwoFromGitHubUrl("")).toBe(undefined);
27-
expect(getNwoFromGitHubUrl("http://github.com/foo/bar")).toBe(undefined);
2827
expect(getNwoFromGitHubUrl("https://ww.github.com/foo/bar")).toBe(
2928
undefined,
3029
);
@@ -35,6 +34,7 @@ describe("github url identifier helper", () => {
3534

3635
it("should handle valid urls", () => {
3736
expect(getNwoFromGitHubUrl("https://github.com/foo/bar")).toBe("foo/bar");
37+
expect(getNwoFromGitHubUrl("http://github.com/foo/bar")).toBe("foo/bar");
3838
expect(getNwoFromGitHubUrl("https://www.github.com/foo/bar")).toBe(
3939
"foo/bar",
4040
);
@@ -47,9 +47,6 @@ describe("github url identifier helper", () => {
4747
describe("getOwnerFromGitHubUrl method", () => {
4848
it("should handle invalid urls", () => {
4949
expect(getOwnerFromGitHubUrl("")).toBe(undefined);
50-
expect(getOwnerFromGitHubUrl("http://github.com/foo/bar")).toBe(
51-
undefined,
52-
);
5350
expect(getOwnerFromGitHubUrl("https://ww.github.com/foo/bar")).toBe(
5451
undefined,
5552
);
@@ -58,6 +55,7 @@ describe("github url identifier helper", () => {
5855
});
5956

6057
it("should handle valid urls", () => {
58+
expect(getOwnerFromGitHubUrl("http://github.com/foo/bar")).toBe("foo");
6159
expect(getOwnerFromGitHubUrl("https://github.com/foo/bar")).toBe("foo");
6260
expect(getOwnerFromGitHubUrl("https://www.github.com/foo/bar")).toBe(
6361
"foo",

0 commit comments

Comments
 (0)