mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-24 05:55:13 +03:00
914e5b2468
Demo: https://github.com/StanGirard/quivr/assets/63923024/bf62c232-b8f0-4092-b324-71c321747de9 issue: https://github.com/StanGirard/quivr/issues/1719
9 lines
304 B
TypeScript
9 lines
304 B
TypeScript
const removeSpecialCharacters = (input: string) =>
|
|
input.normalize("NFD").replace(/[^\w\s.]/g, "");
|
|
|
|
export const cloneFileWithSanitizedName = (file: File): File => {
|
|
const sanitizedFileName = removeSpecialCharacters(file.name);
|
|
|
|
return new File([file], sanitizedFileName, { type: file.type });
|
|
};
|