mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 09:29:24 +00:00
Fix bad spaces
This commit is contained in:
parent
1b347ca0e0
commit
0e1394f46f
@ -10,7 +10,15 @@
|
||||
export const getFilenameFromHeaders = (contentDisposition: string = ''): string | null => {
|
||||
const match = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
||||
if (match && match[1]) {
|
||||
return match[1].replace(/['"]/g, '');
|
||||
const filename = match[1].replace(/['"]/g, '');
|
||||
|
||||
// Decode URL-encoded characters (e.g., %20 -> space)
|
||||
try {
|
||||
return decodeURIComponent(filename);
|
||||
} catch (error) {
|
||||
// If decoding fails, return the original filename
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user