fix: call obsidian binary directly instead of xdg-open for URI handling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 11:42:23 +02:00
parent 180fe43df7
commit ca10cbb20b
+5 -6
View File
@@ -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):
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":