From fdbfd33cc7e462ace8dba4b5a900833da4a50a67 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 17 Dec 2024 22:27:37 -0500 Subject: [PATCH] Fixes from testing I don't know how I missed `.suffix` on the later `stem` loop. Oops. --- tubesync/sync/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 5eb41ac3..0afe44d9 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -1523,7 +1523,7 @@ class Media(models.Model): old_video_path = old_video_path.resolve(strict=True) # build the glob to match other files stem = old_video_path - while '' != stem.suffix: + while stem.suffixes and '' != stem.suffix: stem = Path(stem.stem) old_stem = stem old_prefix_path = old_video_path.parent @@ -1534,7 +1534,7 @@ class Media(models.Model): if new_video_path.exists(): new_video_path = new_video_path.resolve(strict=True) stem = new_video_path - while '' != stem: + while stem.suffixes and '' != stem.suffix: stem = Path(stem.stem) new_stem = stem new_prefix_path = new_video_path.parent @@ -1545,7 +1545,7 @@ class Media(models.Model): other_path.replace(new_file_path) # update the media_file in the db - self.media_file.name = new_video_path.relative_to(media_file_storage.location) + self.media_file.name = str(new_video_path.relative_to(media_file_storage.location)) self.save(update_fields={'media_file'})