From 92c33fb53e09c3cc71e2bdec53239ffd650dbef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=9B=BD=E7=92=87?= Date: Wed, 7 Aug 2024 15:30:14 +0800 Subject: [PATCH] feat: update code --- frontend/src/components/dirent-detail/dirent-details/index.js | 2 +- frontend/src/utils/utils.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/dirent-detail/dirent-details/index.js b/frontend/src/components/dirent-detail/dirent-details/index.js index 39b28fa291f..ed77891723e 100644 --- a/frontend/src/components/dirent-detail/dirent-details/index.js +++ b/frontend/src/components/dirent-detail/dirent-details/index.js @@ -111,7 +111,7 @@ class DirentDetails extends React.Component { const { dirent, direntDetail, collaborators, collaboratorsCache } = this.state; const { repoID, path, fileTags } = this.props; const direntName = dirent?.name || ''; - const smallIconUrl = dirent ? Utils.getDirentIcon(dirent) : ''; + const smallIconUrl = Utils.getDirentIcon(dirent); return ( diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index bbd5951ab00..9abb6dd03fb 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -391,6 +391,7 @@ export const Utils = { }, getDirentIcon: function (dirent, isBig) { + if (!dirent) return mediaUrl + 'img/file/256/' + this.FILEEXT_ICON_MAP['default']; let size = this.isHiDPI() ? 48 : 24; size = isBig ? 192 : size; if (dirent.isDir()) {