This commit is contained in:
2026-08-14 16:03:47 +01:00
parent fd53e3f4fb
commit dfdc3b2840
2463 changed files with 186456 additions and 111315 deletions
+8
View File
@@ -51,8 +51,16 @@ var filterStaticGenerateRoutes = (hono) => {
var isDynamicRoute = (path) => {
return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
};
var ensureWithinOutDir = (outDir, filePath) => {
const normalizedOutDir = joinPaths("/", outDir);
const normalizedFilePath = joinPaths("/", filePath);
if (normalizedFilePath !== normalizedOutDir && !normalizedFilePath.startsWith(`${normalizedOutDir}/`)) {
throw new Error(`Path traversal detected: "${filePath}" is outside the output directory`);
}
};
export {
dirname,
ensureWithinOutDir,
filterStaticGenerateRoutes,
isDynamicRoute,
joinPaths