(contentDisposition: string)
| 13 | } |
| 14 | |
| 15 | export function getFilenameFromContentDisposition(contentDisposition: string): string | undefined { |
| 16 | const encodedFilenameStarMatch = contentDisposition.match(/filename\*=(UTF-8'')?([^;]*)/i) |
| 17 | |
| 18 | if (encodedFilenameStarMatch && typeof encodedFilenameStarMatch[2] === 'string') { |
| 19 | return tryDecodeURIComponent(encodedFilenameStarMatch[2]) |
| 20 | } |
| 21 | |
| 22 | const encodedFilenameMatch = contentDisposition.match(/filename="((?:\\"|[^"])*)"/i) |
| 23 | if (encodedFilenameMatch && typeof encodedFilenameMatch[1] === 'string') { |
| 24 | return encodedFilenameMatch[1].replace(/\\"/g, '"') |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | export function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders { |
| 29 | const merged = { ...a } |
no test coverage detected