don't crash on invalid identifiers

fixes a bug where the link button would not be correctly disabled on invalid identifier values

(regression in 7015fae91c)
This commit is contained in:
Martin Raifer
2023-07-17 19:36:25 +02:00
parent ae7d32f7c0
commit 9bd5817ecc
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -45,6 +45,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :bug: Bugfixes
* Validator: Don't falsely flag certain tags as "should be a closed area" if the tag also allows both area and line geometries in two separate presets (e.g. `highway=elevator` in the "Elevator" and "Inclined Lift" presets)
* Fix sorting of nearby streets in address field dropdown
* Fix bug where "outlink" buttons would not be disabled on invalid values of `identifier` fields
#### :earth_asia: Localization
#### :hourglass: Performance
#### :mortar_board: Walkthrough / Help
+2 -1
View File
@@ -195,6 +195,7 @@ export function uiFieldText(field, context) {
window.open(url, '_blank');
}
})
.classed('disabled', () => !validIdentifierValueForLink())
.merge(outlinkButton);
} else if (field.type === 'url') {
input.attr('type', 'text');
@@ -375,7 +376,7 @@ export function uiFieldText(field, context) {
}
}
if (field.type === 'identifier' && field.pattern) {
return value && value.match(new RegExp(field.pattern))[0];
return value && value.match(new RegExp(field.pattern))?.[0];
}
return null;
}