Skip to content

Commit c576530

Browse files
georgianaonoleata1904akowalska622
authored andcommitted
[ResponseOps][Cases]Allow dashes in host names in Observables (elastic#219038)
Closes elastic#218946 ## Summary - changed the GENERIC_REGEX to allow `-` <img width="488" alt="Screenshot 2025-04-24 at 10 31 00" src="https://github.com/user-attachments/assets/57841c74-9e6c-4600-81f4-8b454d1ddec1" />
1 parent 39f59a7 commit c576530

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

x-pack/platform/plugins/shared/cases/common/observables/validators.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ describe('genericValidator', () => {
6161

6262
expect(result).toBeUndefined();
6363
});
64+
65+
it('should return undefined if the value contains dashes', () => {
66+
const result = validateGenericValue('valid-value');
67+
68+
expect(result).toBeUndefined();
69+
});
6470
});
6571

6672
describe('validateDomain', () => {

x-pack/platform/plugins/shared/cases/common/observables/validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from '../constants';
1919

2020
const DOMAIN_REGEX = /^(?!-)[A-Za-z0-9-]{1,63}(?<!-)\.[A-Za-z]{2,}$/;
21-
const GENERIC_REGEX = /^[a-zA-Z0-9._:/\\]+$/;
21+
const GENERIC_REGEX = /^[a-zA-Z0-9._:/\\-]+$/;
2222

2323
export interface ValidationError {
2424
code: string;

0 commit comments

Comments
 (0)