fix: regex characters in terms shouldn't block submission

Entering an IP address (e.g. 192.168.1.1) or any term with regex
metacharacters made the form invalid because the "regex characters
detected" hint was wired up via $setValidity('terms', 'regex', false).
The text in the UI labels it as a warning, but the form treated it as
an error and refused to save.

Track the warning as a plain $scope flag and show it via ng-show on
that flag, so the form stays valid (#430).
This commit is contained in:
tdurieux
2026-05-04 10:58:17 +02:00
parent 3f095f0734
commit c8fc561dac
3 changed files with 8 additions and 7 deletions
+6 -5
View File
@@ -1375,10 +1375,11 @@ angular
function anonymizeReadme() {
if (!$scope.anonymize || !$scope.anonymize.terms) return;
setValidity("terms", "regex", true);
if ($scope.terms && $scope.terms.match(/[-[\]{}()*+?.,\\^$|#]/g)) {
setValidity("terms", "regex", false);
}
// The "regex characters detected" hint is informational, not a blocker
// — IP addresses, escaped chars, etc. are all legitimate terms (#430).
// Track it as a plain $scope flag so it doesn't mark the form invalid.
$scope.termsRegexWarning =
!!$scope.terms && !!$scope.terms.match(/[-[\]{}()*+?.,\\^$|#]/g);
const urlRegex = /<?\b((https?|ftp|file):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]\b\/?>?/g;
let content = $scope.readme;
if (!$scope.options.image) {
@@ -1486,7 +1487,7 @@ angular
setValidity("sourceUrl", "github", true);
setValidity("conference", "activated", true);
setValidity("terms", "format", true);
setValidity("terms", "regex", true);
$scope.termsRegexWarning = false;
}
function displayErrorMessage(message) {