Skip to content

Commit

Permalink
fix(files): fix file icon display
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Jan 18, 2022
1 parent 4498087 commit 8b59ba1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/components/specific/files/file-uploader/FileUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ export default {
// Only keep allowed files
shouldUpload =
props.allowedFileTypes.includes(file.type) ||
props.allowedFileTypes.includes("." + fileExtension(file.name));
props.allowedFileTypes.includes(fileExtension(file.name));
}
if (props.forbiddenFileTypes.length > 0) {
// Discard forbidden files
shouldUpload = !(
props.forbiddenFileTypes.includes(file.type) ||
props.forbiddenFileTypes.includes("." + fileExtension(file.name))
props.forbiddenFileTypes.includes(fileExtension(file.name))
);
}
if (!shouldUpload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"
size="m"
/>
<BIMDataFileIcon
v-else-if="file.type === 'Ifc'"
fileName=".ifc"
:size="20"
/>
<BIMDataFileIcon
v-else
:fileName="fileExtension(file.name)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
{{
file.type === "Folder"
? $t("FilesTable.folder")
: file.type === "Ifc"
? ".ifc"
: fileExtension(file.name)
? "." + fileExtension(file.name)
? fileExtension(file.name)
: "?"
}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
>
<span class="folder-selector__body__item__icon">
<BIMDataIcon v-if="isFolder(file)" name="folder" size="xs" />
<BIMDataFileIcon
v-else-if="file.type === 'Ifc'"
fileName=".ifc"
:size="13"
/>
<BIMDataFileIcon
v-else
:fileName="fileExtension(file.name)"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/files.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function fileExtension(fileName) {
const parts = fileName.split(".");
return parts.length > 1 ? parts[parts.length - 1] : "";
return parts.length > 1 ? `.${parts[parts.length - 1]}` : "";
}

function formatBytes(bytes, decimals = 2) {
Expand Down

0 comments on commit 8b59ba1

Please sign in to comment.