client: fix get same md5 for file

pull/92/head
fantasticit 2022-06-21 20:34:32 +08:00
parent ea655f27d8
commit 1687dc297c
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}
};