Allow repo names with periods (#1391)
This commit is contained in:
@@ -33,10 +33,10 @@ export const asyncFilter = async function <T>(arr: T[], predicate: (arg0: T) =>
|
||||
|
||||
/**
|
||||
* This regex matches strings of the form `owner/repo` where:
|
||||
* - `owner` is made up of alphanumeric characters or single hyphens, starting and ending in an alphanumeric character
|
||||
* - `repo` is made up of alphanumeric characters, hyphens, or underscores
|
||||
* - `owner` is made up of alphanumeric characters, hyphens, underscores, or periods
|
||||
* - `repo` is made up of alphanumeric characters, hyphens, underscores, or periods
|
||||
*/
|
||||
export const REPO_REGEX = /^(?:[a-zA-Z0-9]+-)*[a-zA-Z0-9]+\/[a-zA-Z0-9-_]+$/;
|
||||
export const REPO_REGEX = /^[a-zA-Z0-9-_\.]+\/[a-zA-Z0-9-_\.]+$/;
|
||||
|
||||
export function getErrorMessage(e: any) {
|
||||
return e instanceof Error ? e.message : String(e);
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('repository-selection', function() {
|
||||
// Test the regex in various "good" cases
|
||||
const goodRepos = [
|
||||
'owner/repo',
|
||||
'owner-with-hyphens/repo-with-hyphens_and_underscores',
|
||||
'owner_with.symbols-/repo.with-symbols_',
|
||||
'ownerWithNumbers58/repoWithNumbers37'
|
||||
];
|
||||
goodRepos.forEach(repo => {
|
||||
@@ -101,7 +101,7 @@ describe('repository-selection', function() {
|
||||
|
||||
// Test the regex in various "bad" cases
|
||||
const badRepos = [
|
||||
'invalid_owner/repo',
|
||||
'invalid*owner/repo',
|
||||
'owner/repo+some&invalid&stuff',
|
||||
'owner-with-no-repo/',
|
||||
'/repo-with-no-owner'
|
||||
|
||||
Reference in New Issue
Block a user