mirror of https://github.com/fantasticit/think.git
client: fix get same md5 for file
parent
ea655f27d8
commit
1687dc297c
|
@ -73,8 +73,10 @@ export const uploadFile = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.size <= FILE_CHUNK_SIZE) {
|
if (file.size <= FILE_CHUNK_SIZE) {
|
||||||
const spark = new SparkMD5.ArrayBuffer();
|
const spark = new SparkMD5();
|
||||||
spark.append(file);
|
spark.append(file);
|
||||||
|
spark.append(file.lastModified);
|
||||||
|
spark.append(file.type);
|
||||||
const md5 = spark.end();
|
const md5 = spark.end();
|
||||||
const url = await uploadFileToServer({ filename, file, md5, onUploadProgress: wraponUploadProgress });
|
const url = await uploadFileToServer({ filename, file, md5, onUploadProgress: wraponUploadProgress });
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -45,6 +45,7 @@ const uploadImage = async ({ file, fileInfo, editor }: FnProps & { fileInfo: Fil
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
editor.commands.deleteRange({ from: from, to: from + loadingNode.nodeSize });
|
editor.commands.deleteRange({ from: from, to: from + loadingNode.nodeSize });
|
||||||
console.log('上传文件失败!');
|
console.log('上传文件失败!');
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue