
























@@ -74,6 +74,15 @@ describe("isPathInside", () => {
7474["/workspace/root", "/workspace/root/nested/file.txt", true],
7575["/workspace/root", "/workspace/root/..file.txt", true],
7676["/workspace/root", "/workspace/root/../escape.txt", false],
77+["/workspace/root", "/workspace/rootless/file.txt", false],
78+["/workspace/root", "/workspace/root/a/b/c/d/e/file.txt", true],
79+["/workspace/root", "/workspace/root/a/..", true],
80+["/workspace/root", "/workspace/root/a/../..", false],
81+["/workspace/root", "/workspace/root/a/b/../../../escape", false],
82+["/", "/anything/at/all", true],
83+["/", "/", true],
84+["foo", "foo/bar", true],
85+["foo", "../escape", false],
7786])("checks posix containment %s -> %s", (basePath, targetPath, expected) => {
7887expect(isPathInside(basePath, targetPath)).toBe(expected);
7988});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。