Drop protocol check

This commit is contained in:
Nora
2023-01-31 14:18:12 +00:00
parent 7ec4b4bc96
commit 9e54e5eced
2 changed files with 2 additions and 7 deletions

View File

@@ -51,9 +51,6 @@ function getNwoOrOwnerFromGitHubUrl(
): string | undefined {
try {
const uri = new URL(githubUrl);
if (uri.protocol !== "https:") {
return;
}
if (uri.hostname !== "github.com" && uri.hostname !== "www.github.com") {
return;
}

View File

@@ -24,7 +24,6 @@ describe("github url identifier helper", () => {
describe("getNwoFromGitHubUrl method", () => {
it("should handle invalid urls", () => {
expect(getNwoFromGitHubUrl("")).toBe(undefined);
expect(getNwoFromGitHubUrl("http://github.com/foo/bar")).toBe(undefined);
expect(getNwoFromGitHubUrl("https://ww.github.com/foo/bar")).toBe(
undefined,
);
@@ -35,6 +34,7 @@ describe("github url identifier helper", () => {
it("should handle valid urls", () => {
expect(getNwoFromGitHubUrl("https://github.com/foo/bar")).toBe("foo/bar");
expect(getNwoFromGitHubUrl("http://github.com/foo/bar")).toBe("foo/bar");
expect(getNwoFromGitHubUrl("https://www.github.com/foo/bar")).toBe(
"foo/bar",
);
@@ -47,9 +47,6 @@ describe("github url identifier helper", () => {
describe("getOwnerFromGitHubUrl method", () => {
it("should handle invalid urls", () => {
expect(getOwnerFromGitHubUrl("")).toBe(undefined);
expect(getOwnerFromGitHubUrl("http://github.com/foo/bar")).toBe(
undefined,
);
expect(getOwnerFromGitHubUrl("https://ww.github.com/foo/bar")).toBe(
undefined,
);
@@ -58,6 +55,7 @@ describe("github url identifier helper", () => {
});
it("should handle valid urls", () => {
expect(getOwnerFromGitHubUrl("http://github.com/foo/bar")).toBe("foo");
expect(getOwnerFromGitHubUrl("https://github.com/foo/bar")).toBe("foo");
expect(getOwnerFromGitHubUrl("https://www.github.com/foo/bar")).toBe(
"foo",