feat: sync full workspace including web modules, docs, and configurations to Gitea
Optimized the root .gitignore to exclude virtual environments, node modules, and temp folders to ensure clean and lightweight version tracking. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
22
axhub-make/vite-plugins/utils/contentDisposition.ts
Normal file
22
axhub-make/vite-plugins/utils/contentDisposition.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
function encodeRFC5987Value(value: string): string {
|
||||
return encodeURIComponent(value).replace(/['()*]/g, (char) =>
|
||||
`%${char.charCodeAt(0).toString(16).toUpperCase()}`,
|
||||
);
|
||||
}
|
||||
|
||||
function createAsciiFallback(fileName: string): string {
|
||||
const normalized = fileName
|
||||
.normalize('NFKD')
|
||||
.replace(/[^\x20-\x7E]+/g, '_')
|
||||
.replace(/["\\;%]/g, '_')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
|
||||
return normalized || 'download';
|
||||
}
|
||||
|
||||
export function buildAttachmentContentDisposition(fileName: string): string {
|
||||
const fallback = createAsciiFallback(fileName);
|
||||
const encoded = encodeRFC5987Value(fileName);
|
||||
return `attachment; filename="${fallback}"; filename*=UTF-8''${encoded}`;
|
||||
}
|
||||
Reference in New Issue
Block a user