mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-06-12 18:37:52 +02:00
feat(#162): add warning message when regex charater is detected inside terms
This commit is contained in:
@@ -203,6 +203,13 @@ a:hover {
|
|||||||
font-size: 45%;
|
font-size: 45%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.warning-feedback {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
font-size: 80%;
|
||||||
|
color: #dc8e35;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-item:focus,
|
.dropdown-item:focus,
|
||||||
.dropdown-item:hover {
|
.dropdown-item:hover {
|
||||||
background-color: var(--hover-bg-color);
|
background-color: var(--hover-bg-color);
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="invalid-feedback"
|
class="invalid-feedback"
|
||||||
ng-show="anonymize.commit.$error.pattern"
|
ng-show="anonymize.commit.$error.pattern || anonymize.commit.$error.required"
|
||||||
>
|
>
|
||||||
The commit SHA is not valid. It should respect this pattern
|
The commit SHA is not valid. It should respect this pattern
|
||||||
[a-fA-Z0-9]{6,}.
|
[a-fA-Z0-9]{6,}.
|
||||||
@@ -236,14 +236,22 @@
|
|||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
ng-class="{'is-invalid': anonymize.terms.$invalid}"
|
ng-class="{'is-invalid': anonymize.terms.$invalid}"
|
||||||
></textarea>
|
></textarea>
|
||||||
<small id="termsHelp" class="form-text text-muted"
|
<small id="termsHelp" class="form-text text-muted">
|
||||||
>One term per line. Each term will be replaced by XXX.</small
|
One term per line. A term is a RegEx! Each term will be replaced
|
||||||
|
by {{site_options.ANONYMIZATION_MASK}}-[Line Number].
|
||||||
|
</small>
|
||||||
|
<div
|
||||||
|
class="warning-feedback"
|
||||||
|
ng-show="anonymize.terms.$error.regex"
|
||||||
>
|
>
|
||||||
|
We identify that you are using some regex characters, if it was
|
||||||
|
not on purpose, please escape them.
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="invalid-feedback"
|
class="invalid-feedback"
|
||||||
ng-show="anonymize.terms.$error.format"
|
ng-show="anonymize.terms.$error.format"
|
||||||
>
|
>
|
||||||
Terms are in an invalid format
|
Terms are in an invalid format.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -332,7 +340,7 @@
|
|||||||
<label class="form-check-label" for="link"
|
<label class="form-check-label" for="link"
|
||||||
>Keep links</label
|
>Keep links</label
|
||||||
>
|
>
|
||||||
<small id="termsHelp" class="form-text text-muted"
|
<small id="linkHelp" class="form-text text-muted"
|
||||||
>Keep or remove all the links.</small
|
>Keep or remove all the links.</small
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -347,7 +355,7 @@
|
|||||||
<label class="form-check-label" for="image"
|
<label class="form-check-label" for="image"
|
||||||
>Display images</label
|
>Display images</label
|
||||||
>
|
>
|
||||||
<small id="termsHelp" class="form-text text-muted"
|
<small id="imageHelp" class="form-text text-muted"
|
||||||
>Images are not anonymized</small
|
>Images are not anonymized</small
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -362,7 +370,7 @@
|
|||||||
<label class="form-check-label" for="pdf"
|
<label class="form-check-label" for="pdf"
|
||||||
>Display PDFs</label
|
>Display PDFs</label
|
||||||
>
|
>
|
||||||
<small id="termsHelp" class="form-text text-muted"
|
<small id="pdfHelp" class="form-text text-muted"
|
||||||
>PDF are not anonymized</small
|
>PDF are not anonymized</small
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -415,7 +423,7 @@
|
|||||||
<label class="form-check-label" for="page"
|
<label class="form-check-label" for="page"
|
||||||
>Github page</label
|
>Github page</label
|
||||||
>
|
>
|
||||||
<small id="termsHelp" class="form-text text-muted"
|
<small id="pageHelp" class="form-text text-muted"
|
||||||
>Enable anonymized Github pages. It currently only
|
>Enable anonymized Github pages. It currently only
|
||||||
supported for Github pages that are defined in the
|
supported for Github pages that are defined in the
|
||||||
same branch. It will be available at
|
same branch. It will be available at
|
||||||
|
|||||||
@@ -1231,6 +1231,14 @@ angular
|
|||||||
}
|
}
|
||||||
|
|
||||||
function anonymize() {
|
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 =
|
const urlRegex =
|
||||||
/<?\b((https?|ftp|file):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]\b\/?>?/g;
|
/<?\b((https?|ftp|file):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]\b\/?>?/g;
|
||||||
let content = $scope.readme;
|
let content = $scope.readme;
|
||||||
@@ -1304,7 +1312,7 @@ angular
|
|||||||
$scope.anonymize.repoUrl.$setValidity("access", true);
|
$scope.anonymize.repoUrl.$setValidity("access", true);
|
||||||
$scope.anonymize.conference.$setValidity("activated", true);
|
$scope.anonymize.conference.$setValidity("activated", true);
|
||||||
$scope.anonymize.terms.$setValidity("format", true);
|
$scope.anonymize.terms.$setValidity("format", true);
|
||||||
$scope.anonymize.terms.$setValidity("format", true);
|
$scope.anonymize.terms.$setValidity("regex", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayErrorMessage(message) {
|
function displayErrorMessage(message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user