diff --git a/public/css/style.css b/public/css/style.css index 094f65f..ae0b7f6 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -203,6 +203,13 @@ a:hover { font-size: 45%; } +.warning-feedback { + width: 100%; + margin-top: 0.25rem; + font-size: 80%; + color: #dc8e35; +} + .dropdown-item:focus, .dropdown-item:hover { background-color: var(--hover-bg-color); diff --git a/public/partials/anonymize.htm b/public/partials/anonymize.htm index f6488ff..d1412a5 100644 --- a/public/partials/anonymize.htm +++ b/public/partials/anonymize.htm @@ -156,7 +156,7 @@ >
The commit SHA is not valid. It should respect this pattern [a-fA-Z0-9]{6,}. @@ -236,14 +236,22 @@ ng-model-options="{ debounce: 250 }" ng-class="{'is-invalid': anonymize.terms.$invalid}" > - One term per line. Each term will be replaced by XXX. + One term per line. A term is a RegEx! Each term will be replaced + by {{site_options.ANONYMIZATION_MASK}}-[Line Number]. + +
+ We identify that you are using some regex characters, if it was + not on purpose, please escape them. +
- Terms are in an invalid format + Terms are in an invalid format.
@@ -332,7 +340,7 @@ - Keep or remove all the links. @@ -347,7 +355,7 @@ - Images are not anonymized @@ -362,7 +370,7 @@ - PDF are not anonymized @@ -415,7 +423,7 @@ - Enable anonymized Github pages. It currently only supported for Github pages that are defined in the same branch. It will be available at diff --git a/public/script/app.js b/public/script/app.js index 23d6f25..3e3406e 100644 --- a/public/script/app.js +++ b/public/script/app.js @@ -1231,6 +1231,14 @@ angular } function anonymize() { + $scope.anonymize.terms.$setValidity("regex", true); + // check if string has regex characters + if ( + $scope.terms && + $scope.terms.match(/[-[\]{}()*+?.,\\^$|#\s]/g) + ) { + $scope.anonymize.terms.$setValidity("regex", false); + } const urlRegex = /?/g; let content = $scope.readme; @@ -1304,7 +1312,7 @@ angular $scope.anonymize.repoUrl.$setValidity("access", true); $scope.anonymize.conference.$setValidity("activated", true); $scope.anonymize.terms.$setValidity("format", true); - $scope.anonymize.terms.$setValidity("format", true); + $scope.anonymize.terms.$setValidity("regex", true); } function displayErrorMessage(message) {