diff --git a/packages/client/src/services/file.ts b/packages/client/src/services/file.ts index cd2e3a75..5ff3c23f 100644 --- a/packages/client/src/services/file.ts +++ b/packages/client/src/services/file.ts @@ -73,8 +73,10 @@ export const uploadFile = async ( } if (file.size <= FILE_CHUNK_SIZE) { - const spark = new SparkMD5.ArrayBuffer(); + const spark = new SparkMD5(); spark.append(file); + spark.append(file.lastModified); + spark.append(file.type); const md5 = spark.end(); const url = await uploadFileToServer({ filename, file, md5, onUploadProgress: wraponUploadProgress }); return url; diff --git a/packages/client/src/tiptap/prose-utils/upload.ts b/packages/client/src/tiptap/prose-utils/upload.ts index 44c3e4e9..20a9ec80 100644 --- a/packages/client/src/tiptap/prose-utils/upload.ts +++ b/packages/client/src/tiptap/prose-utils/upload.ts @@ -45,6 +45,7 @@ const uploadImage = async ({ file, fileInfo, editor }: FnProps & { fileInfo: Fil } catch (e) { editor.commands.deleteRange({ from: from, to: from + loadingNode.nodeSize }); console.log('上传文件失败!'); + throw e; } };