( storageName: string, path?: string, _isDir?: boolean, noStorageName: boolean = false, onlyStorageName: boolean = false )
| 210 | |
| 211 | //转换存储路径 |
| 212 | const convertStoragePath = ( |
| 213 | storageName: string, |
| 214 | path?: string, |
| 215 | _isDir?: boolean, |
| 216 | noStorageName: boolean = false, |
| 217 | onlyStorageName: boolean = false |
| 218 | ): string => { |
| 219 | if (path === '/') { |
| 220 | path = '' |
| 221 | } |
| 222 | const storage = searchStorage(storageName) |
| 223 | console.log(storage) |
| 224 | |
| 225 | switch (storage?.framework) { |
| 226 | case 'rclone': |
| 227 | return ( |
| 228 | (noStorageName ? '' : storageName + ':') + |
| 229 | (onlyStorageName ? '' : path ? formatPathRclone(path) : '') |
| 230 | ) |
| 231 | case 'openlist': { |
| 232 | // 修复双斜杠问题:确保 path 不以 / 开头再拼接 |
| 233 | const normalizedPath = path && path.startsWith('/') ? path.substring(1) : path |
| 234 | return ( |
| 235 | (noStorageName ? '' : openlistInfo.markInRclone + ':') + |
| 236 | (onlyStorageName |
| 237 | ? '' |
| 238 | : normalizedPath |
| 239 | ? formatPathRclone(storageName + '/' + normalizedPath) |
| 240 | : storageName) |
| 241 | ) |
| 242 | } |
| 243 | default: |
| 244 | return '' |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | function searchStorage(keyword: string): StorageList | undefined { |
| 249 | for (const storage of rcloneInfo.storageList) { |
no test coverage detected