(fileBase64: string)
| 159 | } |
| 160 | |
| 161 | const getFileName = (fileBase64: string) => { |
| 162 | let fileNames = [] |
| 163 | if (fileBase64.startsWith('FILE-STORAGE::')) { |
| 164 | const names = fileBase64.substring(14) |
| 165 | if (names.includes('[') && names.includes(']')) { |
| 166 | const files = JSON.parse(names) |
| 167 | return files.join(', ') |
| 168 | } else { |
| 169 | return fileBase64.substring(14) |
| 170 | } |
| 171 | } |
| 172 | if (fileBase64.startsWith('[') && fileBase64.endsWith(']')) { |
| 173 | const files = JSON.parse(fileBase64) |
| 174 | for (const file of files) { |
| 175 | const splitDataURI = file.split(',') |
| 176 | const filename = splitDataURI[splitDataURI.length - 1].split(':')[1] |
| 177 | fileNames.push(filename) |
| 178 | } |
| 179 | return fileNames.join(', ') |
| 180 | } else { |
| 181 | const splitDataURI = fileBase64.split(',') |
| 182 | const filename = splitDataURI[splitDataURI.length - 1].split(':')[1] |
| 183 | return filename |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | export const addLoaderSource = (loader: IDocumentStoreLoader, isGetFileNameOnly = false) => { |
| 188 | let source = 'None' |
no test coverage detected