Skip to content

Commit 0b936da

Browse files
authored
Fix pattern check in filter component (directus#22697)
* Fix pattern check in filter component * Add changeset
1 parent 40a7fd1 commit 0b936da

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.changeset/silly-emus-kick.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@directus/app': patch
3+
---
4+
5+
Fixed the input pattern check in the filter component

app/src/interfaces/_system/system-filter/input-component.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ const inputPattern = computed(() => {
4747
switch (props.type) {
4848
case 'integer':
4949
case 'bigInteger':
50-
return '[+\\-]?[0-9]+';
50+
return '^[+\\-]?[0-9]+$';
5151
case 'decimal':
5252
case 'float':
53-
return '[+\\-]?[0-9]+\\.?[0-9]*';
53+
return '^[+\\-]?[0-9]+\\.?[0-9]*$';
5454
case 'uuid':
55-
return '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}';
55+
return '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$';
5656
default:
57-
return '';
57+
return undefined;
5858
}
5959
});
6060
@@ -77,7 +77,7 @@ watch(
7777
);
7878
7979
function isValueValid(value: any): boolean {
80-
if (value === '' || typeof value !== 'string' || new RegExp(inputPattern.value).test(value)) {
80+
if (value === '' || typeof value !== 'string' || !inputPattern.value || new RegExp(inputPattern.value).test(value)) {
8181
return true;
8282
}
8383

0 commit comments

Comments
 (0)