fix: The file type icon in the file list is sensitive to the case of the suffix name (#3187)

This commit is contained in:
古大羊
2024-05-03 17:31:07 +08:00
committed by GitHub
parent 782375b1cb
commit a9c327cc06
2 changed files with 129 additions and 116 deletions

View File

@@ -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>