MCPcopy
hub / github.com/chenhb23/lanzouyun-disk / isSpecificFile

Function isSpecificFile

src/common/util.ts:65–86  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

63 * 未命名.png.epub.zip
64 */
65export function isSpecificFile(name: string) {
66 if (!name) return false
67
68 // 兼容 v1 版本
69 if (name.endsWith('.lzy.zip')) {
70 name = name.replace(/\.lzy\.zip$/, '')
71 return !/\d$/.test(name)
72 }
73
74 // v2: .原后缀.后缀.后缀
75 const ext = supportList.find(value => name.endsWith(`.${value}`))
76 if (ext) {
77 name = name.replace(/\.\w+?$/, '')
78 const ends = supportList.find(value => name.endsWith(`.${value}`))
79 if (ends) {
80 name = name.replace(/\.\w+?$/, '')
81 if (/\.\d+$/.test(name)) return false
82 return /\.\w+$/.test(name)
83 }
84 }
85 return false
86}
87
88export function restoreFileName(name: string) {
89 if (isSpecificFile(name)) {

Callers 3

initTaskMethod · 0.90
util.test.tsFile · 0.90
restoreFileNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected