Fix: Behandlung von Bildladefehlern für Dokument-Cover Fallback
- onError-Handler zur renderCover-Komponente hinzugefügt, um ein Fallback-Symbol anzuzeigen, wenn das Dokumentbild nicht geladen werden kann. Verhindert eine fehlerhafte Bildanzeige durch , indem die Quelle durch ein standardmäßiges „unbekanntes“ Symbol ersetzt wird.
This commit is contained in:
parent
9b03b39db0
commit
383d2d5d34
@ -1,6 +1,7 @@
|
|||||||
import type { CardProps } from '@mui/material/Card';
|
import type { CardProps } from '@mui/material/Card';
|
||||||
import type { IconifyName } from 'src/components/iconify';
|
import type { IconifyName } from 'src/components/iconify';
|
||||||
|
|
||||||
|
import { useState } from 'react';
|
||||||
import { varAlpha } from 'minimal-shared/utils';
|
import { varAlpha } from 'minimal-shared/utils';
|
||||||
|
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
@ -42,7 +43,7 @@ export function DocItem({
|
|||||||
// />
|
// />
|
||||||
// );
|
// );
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
const renderTitle = (
|
const renderTitle = (
|
||||||
<Link
|
<Link
|
||||||
color="inherit"
|
color="inherit"
|
||||||
@ -102,6 +103,10 @@ export function DocItem({
|
|||||||
component="img"
|
component="img"
|
||||||
alt={doc.name}
|
alt={doc.name}
|
||||||
src={doc.iconSrc}
|
src={doc.iconSrc}
|
||||||
|
onError={(e) => {
|
||||||
|
e.currentTarget.onerror = null;
|
||||||
|
e.currentTarget.src = 'assets/icons/file/unknown.svg';
|
||||||
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
top: 0,
|
top: 0,
|
||||||
width: 1,
|
width: 1,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user