Skip to content

Commit d8656f4

Browse files
Revert "refactor: avoid \x00 in regex validator"
This reverts commit 63f40cf
1 parent 55af1ce commit d8656f4

3 files changed

Lines changed: 4 additions & 56 deletions

File tree

ietf/doc/migrations/0026_alter_dochistory_title_alter_document_title.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

ietf/doc/models.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@
2020
from django.core import checks
2121
from django.core.files.base import File
2222
from django.core.cache import caches
23-
from django.core.validators import (
24-
URLValidator,
25-
RegexValidator,
26-
ProhibitNullCharactersValidator,
27-
)
23+
from django.core.validators import URLValidator, RegexValidator
2824
from django.urls import reverse as urlreverse
2925
from django.contrib.contenttypes.models import ContentType
3026
from django.conf import settings
@@ -111,13 +107,7 @@ class DocumentInfo(models.Model):
111107
time = models.DateTimeField(default=timezone.now) # should probably have auto_now=True
112108

113109
type = ForeignKey(DocTypeName, blank=True, null=True) # Draft, Agenda, Minutes, Charter, Discuss, Guideline, Email, Review, Issue, Wiki, External ...
114-
title = models.CharField(
115-
max_length=255,
116-
validators=[
117-
ProhibitNullCharactersValidator,
118-
validate_no_control_chars,
119-
],
120-
)
110+
title = models.CharField(max_length=255, validators=[validate_no_control_chars, ])
121111

122112
states = models.ManyToManyField(State, blank=True) # plain state (Active/Expired/...), IESG state, stream state
123113
tags = models.ManyToManyField(DocTagName, blank=True) # Revised ID Needed, ExternalParty, AD Followup, ...

ietf/utils/validators.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
# Note that this is an instantiation of the regex validator, _not_ the
3434
# regex-string validator defined right below
3535
validate_no_control_chars = RegexValidator(
36-
regex="^[^\x01-\x1f]*$",
37-
message="Please enter a string without control characters.",
38-
)
36+
regex="^[^\x00-\x1f]*$",
37+
message="Please enter a string without control characters." )
3938

4039

4140
@deconstructible

0 commit comments

Comments
 (0)