From 633f192c8fc59c4ec7a17fb5484d99f57e8c8790 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sat, 27 Dec 2025 22:52:51 +0300 Subject: [PATCH] Fix: Dont crash on download_path being set to root --- app/library/Utils.py | 3 +++ entrypoint.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/library/Utils.py b/app/library/Utils.py index 4ba05617..123222ee 100644 --- a/app/library/Utils.py +++ b/app/library/Utils.py @@ -1702,6 +1702,9 @@ def list_folders(path: Path, base: Path, depth_limit: int) -> list[str]: list[str]: A list of folder paths relative to the base path, up to the specified """ + if "/" == str(path): + return [] + rel_depth: int = len(path.relative_to(base).parts) if rel_depth > depth_limit: return [] diff --git a/entrypoint.sh b/entrypoint.sh index 85246d8d..28a47d04 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,14 +19,14 @@ if [ ! -w "${YTP_CONFIG_PATH}" ]; then exit 1 fi -if [ ! -w "${YTP_DOWNLOAD_PATH}" ]; then +if [ "${YTP_DOWNLOAD_PATH}" != "/" ] && [ ! -w "${YTP_DOWNLOAD_PATH}" ]; then CH_USER=$(stat -c "%u" "${YTP_DOWNLOAD_PATH}") CH_GRP=$(stat -c "%g" "${YTP_DOWNLOAD_PATH}") echo_err "ERROR: Unable to write to '${YTP_DOWNLOAD_PATH}' downloads directory. Current user id '${UID}' while directory owner is '${CH_USER}'." echo_err "[Running under docker]" echo_err "change compose.yaml user: to user:\"${CH_USER}:${CH_GRP}\"" echo_err "Run the following command to change the directory ownership" - echo_err "chown -R \"${CH_USER}:${CH_GRP}\" ./config" + echo_err "chown -R \"${CH_USER}:${CH_GRP}\" ./downloads" echo_err "[Running under podman]" echo_err "change compose.yaml user: to user:\"0:0\"" exit 1