Skip to content

Commit 18097e4

Browse files
authored
Allow repo names with periods (#1391)
1 parent efcade8 commit 18097e4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

extensions/ql-vscode/src/pure/helpers-pure.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export const asyncFilter = async function <T>(arr: T[], predicate: (arg0: T) =>
3333

3434
/**
3535
* This regex matches strings of the form `owner/repo` where:
36-
* - `owner` is made up of alphanumeric characters or single hyphens, starting and ending in an alphanumeric character
37-
* - `repo` is made up of alphanumeric characters, hyphens, or underscores
36+
* - `owner` is made up of alphanumeric characters, hyphens, underscores, or periods
37+
* - `repo` is made up of alphanumeric characters, hyphens, underscores, or periods
3838
*/
39-
export const REPO_REGEX = /^(?:[a-zA-Z0-9]+-)*[a-zA-Z0-9]+\/[a-zA-Z0-9-_]+$/;
39+
export const REPO_REGEX = /^[a-zA-Z0-9-_\.]+\/[a-zA-Z0-9-_\.]+$/;
4040

4141
export function getErrorMessage(e: any) {
4242
return e instanceof Error ? e.message : String(e);

extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/repository-selection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('repository-selection', function() {
7777
// Test the regex in various "good" cases
7878
const goodRepos = [
7979
'owner/repo',
80-
'owner-with-hyphens/repo-with-hyphens_and_underscores',
80+
'owner_with.symbols-/repo.with-symbols_',
8181
'ownerWithNumbers58/repoWithNumbers37'
8282
];
8383
goodRepos.forEach(repo => {
@@ -101,7 +101,7 @@ describe('repository-selection', function() {
101101

102102
// Test the regex in various "bad" cases
103103
const badRepos = [
104-
'invalid_owner/repo',
104+
'invalid*owner/repo',
105105
'owner/repo+some&invalid&stuff',
106106
'owner-with-no-repo/',
107107
'/repo-with-no-owner'

0 commit comments

Comments
 (0)