diff --git a/resources/js/helpers/utils.ts b/resources/js/helpers/utils.ts index b3f28bc..85fbb11 100644 --- a/resources/js/helpers/utils.ts +++ b/resources/js/helpers/utils.ts @@ -119,15 +119,20 @@ export const userHasPermission = (permission: string): boolean => { */ export const convertFileNameToTitle = (fileName: string): string => { // Remove file extension - const fileNameWithoutExtension = fileName.replace(/\.[^/.]+$/, ""); + fileName = fileName.replace(/\.[^/.]+$/, ""); - // Replace dash and underscore with space - const fileNameWithSpaces = fileNameWithoutExtension.replace(/[-_]/g, " "); + // Replace underscores with space + fileName = fileName.replace(/_/g, " "); + + // Replace dashes that are not surrounded by spaces with space + fileName = fileName.replace(/(?