mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 12:06:42 +08:00
### What problem does this PR solve? fix: display specific error message when previewing file error #868 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
import { Skeleton } from 'antd';
|
||||
import { PdfHighlighter, PdfLoader } from 'react-pdf-highlighter';
|
||||
import FileError from '../file-error';
|
||||
import { useCatchError } from '../hooks';
|
||||
|
||||
interface IProps {
|
||||
url: string;
|
||||
}
|
||||
|
||||
const DocumentPreviewer = ({ url }: IProps) => {
|
||||
const PdfPreviewer = ({ url }: IProps) => {
|
||||
const { error } = useCatchError(url);
|
||||
const resetHash = () => {};
|
||||
|
||||
return (
|
||||
@ -15,7 +17,7 @@ const DocumentPreviewer = ({ url }: IProps) => {
|
||||
url={url}
|
||||
beforeLoad={<Skeleton active />}
|
||||
workerSrc="/pdfjs-dist/pdf.worker.min.js"
|
||||
errorMessage={<FileError></FileError>}
|
||||
errorMessage={<FileError>{error}</FileError>}
|
||||
onError={(e) => {
|
||||
console.warn(e);
|
||||
}}
|
||||
@ -40,4 +42,4 @@ const DocumentPreviewer = ({ url }: IProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default DocumentPreviewer;
|
||||
export default PdfPreviewer;
|
||||
|
||||
Reference in New Issue
Block a user