diff --git a/package.json b/package.json index acf930a..18af09e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kne/react-file", - "version": "0.1.32", + "version": "0.1.33", "description": "提供了文件上传,文件预览,文件批量管理等功能", "syntax": { "esmodules": true diff --git a/src/components/FilePreview/typeFormat.js b/src/components/FilePreview/typeFormat.js index a1f4c33..b6d07e5 100644 --- a/src/components/FilePreview/typeFormat.js +++ b/src/components/FilePreview/typeFormat.js @@ -9,6 +9,9 @@ import VideoPreview from './VideoPreview'; import MarkdownPreview from './MarkdownPreview'; const typeFormat = url => { + if (typeof url !== 'string') { + return 'unknown'; + } const path = (url || '').split('?')[0]; const _path = path.toLowerCase(); if (/.txt$/.test(_path)) {