Model uid validator: fix off-by-1 error with the uid.

256bit is actually 43 base64 chars, not 44.
master
Tom Hacohen 5 years ago
parent f4cb7cb74f
commit f1bfb0a9a0

@ -0,0 +1,29 @@
# Generated by Django 3.0.3 on 2020-02-26 14:46
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_etesync', '0015_auto_20200226_1349'),
]
operations = [
migrations.AlterField(
model_name='collection',
name='uid',
field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{43}')]),
),
migrations.AlterField(
model_name='collectionitem',
name='uid',
field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{43}')]),
),
migrations.AlterField(
model_name='collectionitemchunk',
name='uid',
field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{43}')]),
),
]

@ -20,7 +20,7 @@ from django.core.validators import RegexValidator
from django.utils.functional import cached_property
UidValidator = RegexValidator(regex=r'[a-zA-Z0-9\-_=]{44}', message='Not a valid UID. Expected a 256bit base64url.')
UidValidator = RegexValidator(regex=r'[a-zA-Z0-9\-_=]{43}', message='Not a valid UID. Expected a 256bit base64url.')
class Collection(models.Model):

Loading…
Cancel
Save