fix const name
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user