mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-21 16:41:56 +00:00
Memory: harden QMD memory_get path checks
This commit is contained in:
committed by
Vignesh
parent
b7f4755020
commit
c248da0317
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user