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:
+6
-7
@@ -224,15 +224,14 @@ async def open_file(body: dict, user: dict = Depends(current_user)):
|
|||||||
cfg = load_config()
|
cfg = load_config()
|
||||||
vault = cfg.get("obsidian", {}).get("vault", "").strip()
|
vault = cfg.get("obsidian", {}).get("vault", "").strip()
|
||||||
open_target = paths[0]
|
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))
|
dest = os.path.join(vault, os.path.basename(p))
|
||||||
shutil.copy2(p, dest)
|
shutil.copy2(p, dest)
|
||||||
if p == paths[0]:
|
open_target = os.path.join(vault, os.path.basename(paths[0]))
|
||||||
open_target = dest
|
uri = f"obsidian://open?path={quote(open_target, safe='/')}"
|
||||||
else:
|
obsidian_bin = shutil.which("obsidian") or "/usr/bin/obsidian"
|
||||||
open_target = p
|
subprocess.Popen([obsidian_bin, uri])
|
||||||
subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(open_target, safe='/')}"])
|
|
||||||
elif mode == "folder" and shutil.which("dolphin"):
|
elif mode == "folder" and shutil.which("dolphin"):
|
||||||
subprocess.Popen(["dolphin", "--select", paths[0]])
|
subprocess.Popen(["dolphin", "--select", paths[0]])
|
||||||
elif mode == "folder":
|
elif mode == "folder":
|
||||||
|
|||||||
Reference in New Issue
Block a user