MCPcopy Create free account
hub / github.com/VirtualHotBar/NetMount / validateStorageName

Function validateStorageName

src/controller/storage/create.ts:12–27  ·  view source on GitHub ↗

* 验证存储名称

(name: string)

Source from the content-addressed store, hash-verified

10 * 验证存储名称
11 */
12function validateStorageName(name: string): string | null {
13 if (!name || typeof name !== 'string') {
14 return '存储名称不能为空'
15 }
16 if (name.trim().length === 0) {
17 return '存储名称不能为空'
18 }
19 if (name.length > 128) {
20 return '存储名称长度不能超过128字符'
21 }
22 // 检查非法字符
23 if (/[<>:"|?*/\\]/.test(name)) {
24 return '存储名称包含非法字符'
25 }
26 return null
27}
28
29/**
30 * 验证存储类型

Callers 1

validateStorageInputFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected