formacao
This commit is contained in:
+9
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
@@ -19,6 +18,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
||||
var utils_exports = {};
|
||||
__export(utils_exports, {
|
||||
dirname: () => dirname,
|
||||
ensureWithinOutDir: () => ensureWithinOutDir,
|
||||
filterStaticGenerateRoutes: () => filterStaticGenerateRoutes,
|
||||
isDynamicRoute: () => isDynamicRoute,
|
||||
joinPaths: () => joinPaths
|
||||
@@ -76,9 +76,17 @@ const filterStaticGenerateRoutes = (hono) => {
|
||||
const isDynamicRoute = (path) => {
|
||||
return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
|
||||
};
|
||||
const 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`);
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
dirname,
|
||||
ensureWithinOutDir,
|
||||
filterStaticGenerateRoutes,
|
||||
isDynamicRoute,
|
||||
joinPaths
|
||||
|
||||
Reference in New Issue
Block a user