Use DOWNLOAD_ROOT setting instead

This commit is contained in:
tcely 2025-03-12 20:40:14 -04:00 committed by GitHub
parent 469858a33a
commit 291631f76f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,8 +43,8 @@ def source_pre_save(sender, instance, **kwargs):
work_directory = existing_dirpath
for _count in range(parents_count, 0, -1):
work_directory = work_directory.parent
if Path(existing_dirpath.root).resolve(strict=True) == Path(work_directory).resolve(strict=True):
work_directory = Path(settings.DOWNLOADS_BASE_DIR)
if not Path(work_directory).resolve(strict=True).is_relative_to(Path(settings.DOWNLOAD_ROOT)):
work_directory = Path(settings.DOWNLOAD_ROOT)
with TemporaryDirectory(suffix=('.'+new_dirpath.name), prefix='.tmp.', dir=work_directory) as tmp_dir:
tmp_dirpath = Path(tmp_dir)
existed = None