Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/hono/dist/cjs/utils/filepath.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/cjs/utils/filepath.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/hono/dist/cjs/utils/filepath.js
-
curl -L -o filepath.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/cjs/utils/filepath.js
1.09 kB
| Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | |
| //#region src/utils/filepath.ts | |
| const 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); | |
| return getFilePathWithoutDefaultDocument({ | |
| root: options.root, | |
| filename | |
| }); | |
| }; | |
| const getFilePathWithoutDefaultDocument = (options) => { | |
| let root = options.root || ""; | |
| let filename = options.filename; | |
| if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) return; | |
| filename = filename.replace(/^\.?[\/\\]/, ""); | |
| filename = filename.replace(/\\/g, "/"); | |
| root = root.replace(/\/$/, ""); | |
| let path = root ? root + "/" + filename : filename; | |
| path = path.replace(/^\.?\//, ""); | |
| if (root[0] !== "/" && path[0] === "/") return; | |
| return path; | |
| }; | |
| //#endregion | |
| exports.getFilePath = getFilePath; | |
| exports.getFilePathWithoutDefaultDocument = getFilePathWithoutDefaultDocument; | |