MCPcopy Create free account
hub / github.com/CatMuse/HiNote / fromSafeFileName

Method fromSafeFileName

src/storage/FilePathUtils.ts:23–29  ·  view source on GitHub ↗

* 从安全文件名恢复原始路径(需要配合映射文件) * @param safeFileName 安全文件名 * @returns 恢复的原始路径(近似)

(safeFileName: string)

Source from the content-addressed store, hash-verified

21 * @returns 恢复的原始路径(近似)
22 */
23 static fromSafeFileName(safeFileName: string): string {
24 // 移除 .json 后缀并将下划线转回空格
25 // 注意:这是近似恢复,无法完全还原特殊字符
26 return safeFileName
27 .replace(/\.json$/, '')
28 .replace(/_/g, ' ');
29 }
30
31 /**
32 * 生成文件路径的哈希值(备用方案)

Callers 1

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected