Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 7af232f

Browse files
oodamienghillert
authored andcommitted
Register App: URI regex fix
Resolves #838: simplify validation URI
1 parent 9d7d604 commit 7af232f

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

ui/src/app/apps/apps-register/apps-register.validator.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ describe('AppsRegisterValidator', () => {
3434
it('invalid', () => {
3535
[
3636
' ',
37-
'http://foo. bar',
38-
'http://foo.b@r',
39-
'http://foo.b%%r',
4037
'f'
4138
].forEach((mock) => {
4239
const uri: FormControl = new FormControl(mock);

ui/src/app/apps/apps-register/apps-register.validator.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ export class AppsRegisterValidator {
1616
/**
1717
* Uri regex
1818
*/
19-
static uriRegex = /^([a-zA-Z0-9-]+:\/\/)([\\w\\.:-]+)?([a-zA-Z0-9-\/.:-]+)*$/;
20-
21-
22-
/**
23-
* Docker artifact regex
24-
*/
25-
static dockerArtifactRegex = /^(docker:)([a-zA-Z0-9-.-_]*)(\/)([a-zA-Z0-9-.-_]*)(\:)([a-zA-Z0-9-.-_]*)$/;
19+
static uriRegex = /^.{2,250}$/;
2620

2721
/**
2822
* Validate the name conditions: no space, 2 characters min, no specials characters
@@ -53,7 +47,7 @@ export class AppsRegisterValidator {
5347
return null;
5448
}
5549

56-
if (!AppsRegisterValidator.uriRegex.test(formControl.value) && !AppsRegisterValidator.dockerArtifactRegex.test(formControl.value)) {
50+
if (!AppsRegisterValidator.uriRegex.test(formControl.value)) {
5751
return { invalid: true };
5852
}
5953

0 commit comments

Comments
 (0)