michangarrito/apps/mcp-server/node_modules/hono/dist/utils/filepath.js
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- database/ (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:02 -06:00

36 lines
1016 B
JavaScript

// src/utils/filepath.ts
var getFilePath = (options) => {
let filename = options.filename;
const defaultDocument = options.defaultDocument || "index.html";
if (filename.endsWith("/")) {
filename = filename.concat(defaultDocument);
} else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) {
filename = filename.concat("/" + defaultDocument);
}
const path = getFilePathWithoutDefaultDocument({
root: options.root,
filename
});
return path;
};
var getFilePathWithoutDefaultDocument = (options) => {
let root = options.root || "";
let filename = options.filename;
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
return;
}
filename = filename.replace(/^\.?[\/\\]/, "");
filename = filename.replace(/\\/, "/");
root = root.replace(/\/$/, "");
let path = root ? root + "/" + filename : filename;
path = path.replace(/^\.?\//, "");
if (root[0] !== "/" && path[0] === "/") {
return;
}
return path;
};
export {
getFilePath,
getFilePathWithoutDefaultDocument
};