Fix: Dont crash on download_path being set to root

This commit is contained in:
arabcoders 2025-12-27 22:52:51 +03:00
parent 4773e73d88
commit 633f192c8f
2 changed files with 5 additions and 2 deletions

View file

@ -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 []

View file

@ -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