Merge pull request #16785 from pitwegner/master

Allow IDN domain names in annotations
This commit is contained in:
Patrik Oldsberg
2023-04-04 17:51:09 +02:00
committed by GitHub
4 changed files with 13 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/catalog-model': minor
---
Modified the regex for DNS label validation to support IDN domains
@@ -125,7 +125,7 @@ describe('CommonValidatorFunctions', () => {
['a-b', true],
['-a-b', false],
['a-b-', false],
['a--b', false],
['a--b', true],
['a_b', false],
['adam.bertil.caesar', true],
['adam.ber-til.caesar', true],
@@ -154,7 +154,8 @@ describe('CommonValidatorFunctions', () => {
['a-b', true],
['-a-b', false],
['a-b-', false],
['a--b', false],
['a--b', true],
['xn--c6h', true],
['a_b', false],
[`${'a'.repeat(63)}`, true],
[`${'a'.repeat(64)}`, false],
@@ -91,7 +91,7 @@ export class CommonValidatorFunctions {
typeof value === 'string' &&
value.length >= 1 &&
value.length <= 63 &&
/^[a-z0-9]+(\-[a-z0-9]+)*$/.test(value)
/^[a-z0-9]+(?:\-+[a-z0-9]+)*$/.test(value)
);
}
@@ -31,7 +31,7 @@ describe('KubernetesValidatorFunctions', () => {
['a/a', true],
['a/aAb5C', true],
['a-b.c/v1', true],
['a--b.c/v1', false],
['a--b.c/v1', true],
[
`${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat(
61,
@@ -96,7 +96,7 @@ describe('KubernetesValidatorFunctions', () => {
['a-b', true],
['-a-b', false],
['a-b-', false],
['a--b', false],
['a--b', true],
['a_b', false],
['a.b', false],
])(`isValidNamespace %p ? %p`, (value, matches) => {
@@ -121,7 +121,7 @@ describe('KubernetesValidatorFunctions', () => {
['a..b', true],
['a/a', true],
['a-b.c/a', true],
['a--b.c/a', false],
['a--b.c/a', true],
[
`${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat(
61,
@@ -178,7 +178,7 @@ describe('KubernetesValidatorFunctions', () => {
['a..b', true],
['a/a', true],
['a-b.c/a', true],
['a--b.c/a', false],
['a--b.c/a', true],
[
`${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat(
61,