diff options
Diffstat (limited to 'src/misc')
| -rw-r--r-- | src/misc/content-disposition.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/misc/content-disposition.ts b/src/misc/content-disposition.ts new file mode 100644 index 0000000000..9df7ed4688 --- /dev/null +++ b/src/misc/content-disposition.ts @@ -0,0 +1,6 @@ +const cd = require('content-disposition'); + +export function contentDisposition(type: 'inline' | 'attachment', filename: string): string { + const fallback = filename.replace(/[^\w.-]/g, '_'); + return cd(filename, { type, fallback }); +} |