Memory: harden QMD memory_get path checks

This commit is contained in:
Benjamin Jesuiter
2026-02-02 20:47:20 +01:00
committed by Vignesh
parent b7f4755020
commit c248da0317

View File

@@ -280,6 +280,13 @@ export class QmdMemoryManager implements MemorySearchManager {
const relPath = params.relPath?.trim();
if (!relPath) throw new Error("path required");
const absPath = this.resolveReadPath(relPath);
if (!absPath.endsWith(".md")) {
throw new Error("path required");
}
const stat = await fs.lstat(absPath);
if (stat.isSymbolicLink() || !stat.isFile()) {
throw new Error("path required");
}
const content = await fs.readFile(absPath, "utf-8");
if (!params.from && !params.lines) {
return { text: content, path: relPath };