mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 13:36:35 +00:00
Merge pull request #592 from tcely/patch-6
Some checks failed
Run Django tests for TubeSync / test (3.7) (push) Has been cancelled
Run Django tests for TubeSync / test (3.8) (push) Has been cancelled
Run Django tests for TubeSync / test (3.9) (push) Has been cancelled
Run Django tests for TubeSync / containerise (push) Has been cancelled
Some checks failed
Run Django tests for TubeSync / test (3.7) (push) Has been cancelled
Run Django tests for TubeSync / test (3.8) (push) Has been cancelled
Run Django tests for TubeSync / test (3.9) (push) Has been cancelled
Run Django tests for TubeSync / containerise (push) Has been cancelled
Use Path in file_is_editable
This commit is contained in:
commit
904c57f603
@ -100,15 +100,16 @@ def file_is_editable(filepath):
|
|||||||
'''
|
'''
|
||||||
allowed_paths = (
|
allowed_paths = (
|
||||||
# Media item thumbnails
|
# Media item thumbnails
|
||||||
os.path.commonpath([os.path.abspath(str(settings.MEDIA_ROOT))]),
|
Path(str(settings.MEDIA_ROOT)).resolve(),
|
||||||
|
|
||||||
# Downloaded media files
|
# Downloaded media files
|
||||||
os.path.commonpath([os.path.abspath(str(settings.DOWNLOAD_ROOT))]),
|
Path(str(settings.DOWNLOAD_ROOT)).resolve(),
|
||||||
)
|
)
|
||||||
filepath = os.path.abspath(str(filepath))
|
filepath = Path(str(filepath)).resolve()
|
||||||
if not os.path.isfile(filepath):
|
if not filepath.is_file():
|
||||||
return False
|
return False
|
||||||
for allowed_path in allowed_paths:
|
for allowed_path in allowed_paths:
|
||||||
if allowed_path == os.path.commonpath([allowed_path, filepath]):
|
if str(allowed_path) == os.path.commonpath([allowed_path, filepath]):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user