Fix: server.py ?file= query-Endpoint greift bei /api/vault/file/ (ohne trailing)
Bug: obv's do_GET strippt trailing '/' via path.rstrip('/'), sodass
startswith('/api/vault/file/') nie triggert für /api/vault/file/. HermesCustom
kann daher ?file= nicht nutzen.
Fix: explizit beide Pfade matchen (mit und ohne trailing '/').
Außerdem: Wiki-Serve-Skript zeigt jetzt standardmäßig auf ~/repos/hermes-wiki-viewer
statt auf ~/.local/share/hermes-wiki/owv, sodass Lukas-Customizations automatisch
aktiv sind nach Skript-Update.
This commit is contained in:
@@ -217,13 +217,15 @@ class VaultHandler(BaseHTTPRequestHandler):
|
||||
params = urllib.parse.parse_qs(query_string)
|
||||
q = params.get("q", [""])[0]
|
||||
self._json({"results": _search(VAULT_DIR, q) if q else []})
|
||||
elif path.startswith("/api/vault/file/"):
|
||||
rel = unquote(path[len("/api/vault/file/"):])
|
||||
elif path == "/api/vault/file" or path.startswith("/api/vault/file/"):
|
||||
if path == "/api/vault/file":
|
||||
rel = ""
|
||||
else:
|
||||
rel = unquote(path[len("/api/vault/file/"):])
|
||||
# Lukas-add: also support ?file=<path> query for clean URL navigation
|
||||
if "?" in rel:
|
||||
rel, _, query = rel.partition("?")
|
||||
if not rel and query_string:
|
||||
from urllib.parse import parse_qs
|
||||
file_param = parse_qs(query).get("file", [None])[0]
|
||||
file_param = parse_qs(query_string).get("file", [None])[0]
|
||||
if file_param:
|
||||
rel = file_param
|
||||
file_path = VAULT_DIR / rel
|
||||
|
||||
Reference in New Issue
Block a user