mirror of
https://github.com/django/django.git
synced 2025-11-30 23:38:10 +00:00
Ref #23919 -- Replaced some os.path usage with pathlib.Path.
This commit is contained in:
parent
5d923f2d8c
commit
11b8c30b9e
10 changed files with 54 additions and 57 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue