Skip to content

Commit

Permalink
fix: 🐛 fix url not detecting with / at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
tobycm committed Jun 2, 2024
1 parent 063f37f commit 2bf6317
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ <h1>Random Issue Picker</h1>
* @returns {string} The name of the repository.
*/
function parseUrl(url) {
const name = url.match(/(?:git@|https:\/\/)github.com[:\/](.*)/);
url = url.trim();
let name = url.match(/(?:git@|https:\/\/)github.com[:\/](.*)\/?/);

if (name) return name[1].replace(/\.git$/, "");
return null;
if (!name) return null;

name = name[1].replace(/\.git$/, "");
if (name.endsWith("/")) name = name.slice(0, -1);
return name;
}

/**
Expand Down

0 comments on commit 2bf6317

Please sign in to comment.