(fileBase64: string)
| 354 | * @param {string} fileBase64 |
| 355 | */ |
| 356 | export const getFileName = (fileBase64: string): string => { |
| 357 | let fileNames = [] |
| 358 | if (fileBase64.startsWith('FILE-STORAGE::')) { |
| 359 | const names = fileBase64.substring(14) |
| 360 | if (names.includes('[') && names.includes(']')) { |
| 361 | const files = JSON.parse(names) |
| 362 | return files.join(', ') |
| 363 | } else { |
| 364 | return fileBase64.substring(14) |
| 365 | } |
| 366 | } |
| 367 | if (fileBase64.startsWith('[') && fileBase64.endsWith(']')) { |
| 368 | const files = JSON.parse(fileBase64) |
| 369 | for (const file of files) { |
| 370 | const splitDataURI = file.split(',') |
| 371 | const filename = splitDataURI[splitDataURI.length - 1].split(':')[1] |
| 372 | fileNames.push(filename) |
| 373 | } |
| 374 | return fileNames.join(', ') |
| 375 | } else { |
| 376 | const splitDataURI = fileBase64.split(',') |
| 377 | const filename = splitDataURI[splitDataURI.length - 1].split(':')[1] |
| 378 | return filename |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Save upsert flowData |
no test coverage detected