Skip to content

Commit 9da32af

Browse files
authored
refactor: remove temporary image directory validation (#772)
1 parent 99b088e commit 9da32af

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/tools/read.shared.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ export async function processImage(
6767
const stats = fs.statSync(filePath);
6868
const ext = path.extname(filePath).toLowerCase();
6969

70-
const resolvedPath = path.resolve(filePath);
71-
const normalizedCwd = path.resolve(cwd);
72-
if (!resolvedPath.startsWith(normalizedCwd)) {
73-
throw new Error('Invalid file path: path traversal detected');
74-
}
70+
// Why? The image directory validation was originally placed outside for agent-browser.
71+
// The check has been temporarily removed for adjustment.
72+
// const resolvedPath = path.resolve(filePath);
73+
// const normalizedCwd = path.resolve(cwd);
74+
// if (!resolvedPath.startsWith(normalizedCwd)) {
75+
// throw new Error('Invalid file path: path traversal detected');
76+
// }
7577

7678
const buffer = fs.readFileSync(filePath);
7779

0 commit comments

Comments
 (0)