From ca10cbb20bdfb7b401c67fd5d3f7dfa59d1038ca Mon Sep 17 00:00:00 2001 From: "thomas.kopp" Date: Thu, 2 Apr 2026 11:42:23 +0200 Subject: [PATCH] fix: call obsidian binary directly instead of xdg-open for URI handling Co-Authored-By: Claude Sonnet 4.6 --- api/router.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/api/router.py b/api/router.py index 4f7d750..c5c6adb 100644 --- a/api/router.py +++ b/api/router.py @@ -224,15 +224,14 @@ async def open_file(body: dict, user: dict = Depends(current_user)): cfg = load_config() vault = cfg.get("obsidian", {}).get("vault", "").strip() open_target = paths[0] - for p in paths: - if vault and os.path.isdir(vault): + if vault and os.path.isdir(vault): + for p in paths: dest = os.path.join(vault, os.path.basename(p)) shutil.copy2(p, dest) - if p == paths[0]: - open_target = dest - else: - open_target = p - subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(open_target, safe='/')}"]) + open_target = os.path.join(vault, os.path.basename(paths[0])) + uri = f"obsidian://open?path={quote(open_target, safe='/')}" + obsidian_bin = shutil.which("obsidian") or "/usr/bin/obsidian" + subprocess.Popen([obsidian_bin, uri]) elif mode == "folder" and shutil.which("dolphin"): subprocess.Popen(["dolphin", "--select", paths[0]]) elif mode == "folder":