Skip to content

Commit

Permalink
not used imports, file url or title
Browse files Browse the repository at this point in the history
  • Loading branch information
hblankenship committed Nov 6, 2024
1 parent f09ba55 commit be5b56b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import warnings
from datetime import datetime
from pathlib import Path
from typing import Dict, Optional, Set
from uuid import uuid4

import hyperlink
Expand Down Expand Up @@ -749,7 +748,12 @@ def clean(self):

valid_extensions = settings.FILE_UPLOAD_TYPES

if Path(self.file.url).suffix.lower() not in valid_extensions:
# why does this not work with self.file....
if self.file:
file_name = self.file.url
else:
file_name = self.title
if Path(file_name).suffix.lower() not in valid_extensions:
if accepted_extensions := f"{', '.join(valid_extensions)}":
msg = (
_("Unsupported extension. Supported extensions are as follows: %s") % accepted_extensions
Expand Down

0 comments on commit be5b56b

Please sign in to comment.