From 7cad5b768418987c78a28c101303e4d29c86ba5c Mon Sep 17 00:00:00 2001 From: FatihMakes Date: Tue, 25 Aug 2026 04:46:40 +0300 Subject: [PATCH] Update file_controller.py --- actions/file_controller.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/actions/file_controller.py b/actions/file_controller.py index 97663f0..ab338bb 100644 --- a/actions/file_controller.py +++ b/actions/file_controller.py @@ -80,9 +80,21 @@ def _resolve_path(raw: str) -> Path: "videos": _get_videos(), "home": Path.home(), } - lower = raw.strip().lower() + raw = raw.strip().strip('"').strip("'") + lower = raw.lower() if lower in shortcuts: return shortcuts[lower] + + # "desktop/notlar/a.md" ve "desktop\notlar\a.md" — kisayol + alt yol. + # Bu dal olmadan tum dize asagidaki goreli-yol dalina dusuyor ve process'in + # CWD'sine gore cozuluyordu. Proje home disindaysa _is_safe_path reddedip + # "Access denied" veriyor; home icindeyse daha kotusu oluyor ve dosya sessizce + # projenin icindeki olmayan bir "desktop" klasorune yaziliyordu. + head, sep, rest = raw.replace("\\", "/").partition("/") + if sep and head.lower() in shortcuts: + rest = rest.strip("/") + return shortcuts[head.lower()] / rest if rest else shortcuts[head.lower()] + return Path(raw).expanduser() def _format_size(b: int) -> str: @@ -540,4 +552,4 @@ def file_controller( return f"Unknown action: '{action}'" except Exception as e: - return f"File controller error ({action}): {e}" \ No newline at end of file + return f"File controller error ({action}): {e}"