From 665a40ed0eba5703c788a98c9c53464f026fe9c0 Mon Sep 17 00:00:00 2001 From: NecRaul Date: Sun, 8 Mar 2026 11:33:44 +0400 Subject: [PATCH] util: add helper to read .hidden file --- copyparty/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/copyparty/util.py b/copyparty/util.py index 13113199..605bd775 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -2381,6 +2381,13 @@ def u8safe(txt: str) -> str: except: return txt.encode("utf-8", "replace").decode("utf-8", "replace") +def load_dothidden(dpath: str) -> set[str]: + try: + with open(os.path.join(dpath, ".hidden"), "rb") as f: + return {ln.strip() for ln in f.read().decode("utf-8", "replace").splitlines()} + except OSError: + return {} + def exclude_dotfiles(filepaths: list[str]) -> list[str]: return [x for x in filepaths if not x.split("/")[-1].startswith(".")]