diff options
author | James Woglom <j@wogloms.net> | 2022-09-19 15:31:46 -0400 |
---|---|---|
committer | James Woglom <j@wogloms.net> | 2022-09-19 15:40:22 -0400 |
commit | a07e1ed06c65bb473219ba4bf0372aabd35afee4 (patch) | |
tree | c2f1324cbe2ccbd0614ae61168e58bf55989eda6 | |
parent | temporarily enable running CI on my forked branch. revert this before merging (diff) | |
download | metube-a07e1ed06c65bb473219ba4bf0372aabd35afee4.tar.gz metube-a07e1ed06c65bb473219ba4bf0372aabd35afee4.tar.bz2 metube-a07e1ed06c65bb473219ba4bf0372aabd35afee4.zip |
bugfix: resolve full base directory before startswith check
-rw-r--r-- | app/ytdl.py | 7 | ||||
-rw-r--r-- | ui/src/app/app.component.ts | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/ytdl.py b/app/ytdl.py index fd1c27f..97fa0a8 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -234,11 +234,12 @@ class DownloadQueue: if self.config.CUSTOM_DIRS != 'true':
return {'status': 'error', 'msg': f'A folder for the download was specified but CUSTOM_DIRS is not true in the configuration.'}
dldirectory = os.path.realpath(os.path.join(base_directory, folder))
- if not dldirectory.startswith(base_directory):
- return {'status': 'error', 'msg': f'Folder "{folder}" must resolve inside the base download directory "{base_directory}"'}
+ real_base_directory = os.path.realpath(base_directory)
+ if not dldirectory.startswith(real_base_directory):
+ return {'status': 'error', 'msg': f'Folder "{folder}" must resolve inside the base download directory "{real_base_directory}"'}
if not os.path.isdir(dldirectory):
if self.config.CREATE_CUSTOM_DIRS != 'true':
- return {'status': 'error', 'msg': f'Folder "{folder}" for download does not exist inside base directory "{base_directory}", and CREATE_CUSTOM_DIRS is not true in the configuration.'}
+ return {'status': 'error', 'msg': f'Folder "{folder}" for download does not exist inside base directory "{real_base_directory}", and CREATE_CUSTOM_DIRS is not true in the configuration.'}
os.makedirs(dldirectory, exist_ok=True)
else:
dldirectory = base_directory
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index eae1ba9..20db8b8 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -156,6 +156,7 @@ export class AppComponent implements AfterViewInit { format = format ?? this.format folder = folder ?? this.folder + console.debug('Downloading: url='+url+' quality='+quality+' format='+format+' folder='+folder); this.addInProgress = true; this.downloads.add(url, quality, format, folder).subscribe((status: Status) => { if (status.status === 'error') { |