fix: The file type icon in the file list is sensitive to the case of the suffix name (#3187)
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
:data-type="type"
|
||||
:aria-label="name"
|
||||
:aria-selected="isSelected"
|
||||
:data-ext="getExtension(name).toLowerCase()"
|
||||
>
|
||||
<div>
|
||||
<img
|
||||
@@ -270,4 +271,14 @@ const click = (event: Event | KeyboardEvent) => {
|
||||
const open = () => {
|
||||
router.push({ path: props.url });
|
||||
};
|
||||
|
||||
const getExtension = (fileName: string): string => {
|
||||
const lastDotIndex = fileName.lastIndexOf('.');
|
||||
if (lastDotIndex === -1) {
|
||||
return fileName;
|
||||
}
|
||||
return fileName.substring(lastDotIndex );
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user