Remove directory manipulation

Added a comment about why these directories aren't matching.
This commit is contained in:
tcely 2025-01-26 07:54:14 -05:00 committed by GitHub
parent 7b1aedf7ae
commit bcbafaf842
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1304,10 +1304,12 @@ class Media(models.Model):
def filename_prefix(self): def filename_prefix(self):
if self.downloaded and self.media_file: if self.downloaded and self.media_file:
mf_path = Path(self.media_file.path) filename = self.media_file.path
filename = str(mf_path.relative_to(self.source.directory_path))
else: else:
filename = self.filename filename = self.filename
# The returned prefix should not contain any directories.
# So, we do not care about the different directories
# used for filename in the cases above.
prefix, ext = os.path.splitext(os.path.basename(filename)) prefix, ext = os.path.splitext(os.path.basename(filename))
return prefix return prefix