MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / fileExists

Method fileExists

openlist/openlist.ts:867–876  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

865 let p = input.replace(/\/+$/, "");
866 if (!p.endsWith("/openlist")) p = `${p}/openlist`;
867 return p;
868 }
869
870 /**
871 * 校验并归一化用户传入的安装目录。
872 * 安装目录会被直接拼接进双引号包裹的 shell 字符串中执行,
873 * 若不过滤会导致命令注入(如传入 `"; rm -rf / #` 或包含 `"` `` `$` `\` 等字符)。
874 * 仅允许绝对路径、白名单字符(字母/数字/./-/_),且不允许 `..` 路径穿越。
875 */
876 private sanitizeInstallPath(input: string | undefined): { ok: true; path: string } | { ok: false; reason: string } {
877 if (!input || !input.trim()) {
878 return { ok: true, path: "/opt/openlist" };
879 }

Callers 7

handleInstallMethod · 0.95
handleUpdateMethod · 0.95
handleUninstallMethod · 0.95
handleAdminMethod · 0.95
handleSetPortMethod · 0.95
handleStatusMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected