Memory: harden QMD memory_get path checks

main
Benjamin Jesuiter 2026-02-02 20:47:20 +01:00 committed by Vignesh
parent b7f4755020
commit c248da0317
1 changed files with 7 additions and 0 deletions

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 };