summaryrefslogtreecommitdiff
path: root/django/core/validators.py
diff options
context:
space:
mode:
authorTom <tom@tomforb.es>2017-07-21 21:33:26 +0100
committerTim Graham <timograham@gmail.com>2018-04-19 21:30:00 -0400
commit11b8c30b9e02ef6ecb996ad3280979dfeab700fa (patch)
treea086c9dc9bfe15f58da7db1393f122e690d5a670 /django/core/validators.py
parent5d923f2d8cadb06497d255097caa4583d66b697a (diff)
downloaddjango-11b8c30b9e02ef6ecb996ad3280979dfeab700fa.tar.gz
Ref #23919 -- Replaced some os.path usage with pathlib.Path.
Diffstat (limited to 'django/core/validators.py')
-rw-r--r--django/core/validators.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 965f35cbab..92394a7eae 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -1,6 +1,6 @@
import ipaddress
-import os
import re
+from pathlib import Path
from urllib.parse import urlsplit, urlunsplit
from django.core.exceptions import ValidationError
@@ -480,7 +480,7 @@ class FileExtensionValidator:
self.code = code
def __call__(self, value):
- extension = os.path.splitext(value.name)[1][1:].lower()
+ extension = Path(value.name).suffix[1:].lower()
if self.allowed_extensions is not None and extension not in self.allowed_extensions:
raise ValidationError(
self.message,