self._validate_filepath(v.name)
def _validate_filepath(self, s):
_, extension = os.path.splitext(s)
if extension.lower() not in self.allowed_extensions:
raise ValidationError(
f"File of type {extension} is not supported."
" Allowed types are "
After Change
self._validate_filepath(v.name)
def _validate_filepath(self, s):
extensions = Path(s).suffixes
extension = "".join(extensions)
if extension.lower() not in self.allowed_extensions:
raise ValidationError(