(fileInput: unknown)
| 220 | const determinedFileType: string | undefined = params.fileType |
| 221 | |
| 222 | const resolveFilePath = (fileInput: unknown): string | null => { |
| 223 | if (!isRecord(fileInput)) return null |
| 224 | |
| 225 | if (typeof fileInput.path === 'string') { |
| 226 | return fileInput.path |
| 227 | } |
| 228 | |
| 229 | if (typeof fileInput.url === 'string') { |
| 230 | return fileInput.url |
| 231 | } |
| 232 | |
| 233 | if (typeof fileInput.key === 'string') { |
| 234 | const key = fileInput.key |
| 235 | const context = |
| 236 | typeof fileInput.context === 'string' ? fileInput.context : inferContextFromKey(key) |
| 237 | return `/api/files/serve/${encodeURIComponent(key)}?context=${context}` |
| 238 | } |
| 239 | |
| 240 | return null |
| 241 | } |
| 242 | |
| 243 | // Determine the file path(s) based on input parameters. |
| 244 | // Precedence: direct filePath > file array > single file object > legacy files array |
no test coverage detected