* 验证存储名称
(name: string)
| 10 | * 验证存储名称 |
| 11 | */ |
| 12 | function 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 | * 验证存储类型 |
no outgoing calls
no test coverage detected