fix const name

This commit is contained in:
smanylov
2026-01-04 17:44:42 +07:00
parent 630a108968
commit 9f41386b65
+4 -4
View File
@@ -83,21 +83,21 @@ const formatDateTime = (timestamp: number) => {
}; };
const cutFileName = (fileName: string) => { const cutFileName = (fileName: string) => {
const MAX_FILE_NAME_LENGHT= 26; const MAX_FILE_NAME_LENGTH= 26;
const lastDotIndex = fileName.lastIndexOf('.'); const lastDotIndex = fileName.lastIndexOf('.');
if (lastDotIndex <= 0) { if (lastDotIndex <= 0) {
return fileName.length > MAX_FILE_NAME_LENGHT ? fileName.substring(0, MAX_FILE_NAME_LENGHT - 3) + '...' : fileName; return fileName.length > MAX_FILE_NAME_LENGTH ? fileName.substring(0, MAX_FILE_NAME_LENGTH - 3) + '...' : fileName;
} }
const nameWithoutExtension = fileName.substring(0, lastDotIndex); const nameWithoutExtension = fileName.substring(0, lastDotIndex);
const extension = fileName.substring(lastDotIndex); const extension = fileName.substring(lastDotIndex);
if (fileName.length <= MAX_FILE_NAME_LENGHT) { if (fileName.length <= MAX_FILE_NAME_LENGTH) {
return fileName; return fileName;
} }
const maxNameLength = MAX_FILE_NAME_LENGHT - extension.length - 3; const maxNameLength = MAX_FILE_NAME_LENGTH - extension.length - 3;
if (maxNameLength <= 0) { if (maxNameLength <= 0) {
return '...' + extension; return '...' + extension;