u
This commit is contained in:
1 parent
b7f2efc7c3
commit
cc88205cba
23 files changed
+1239
-799
No files matched your search
@@ -146,21 +146,12 @@ export async function httpUpload(url, file, extraData = {}, config = {}) {
|
||||
}
|
||||
|
||||
async function appendFile(formData, file) {
|
||||
// ✅ 已经是 File / Blob
|
||||
if (file instanceof File || file instanceof Blob) {
|
||||
formData.append("file", file);
|
||||
return;
|
||||
}
|
||||
|
||||
// ✅ 处理 blob:http://xxx
|
||||
if (typeof file === "string" && file.startsWith("blob:")) {
|
||||
const blob = await fetch(file).then((res) => res.blob());
|
||||
|
||||
formData.append("file", blob);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error("不支持的文件类型:" + typeof file);
|
||||
throw new Error("上传只支持 File 或 Blob,不支持字符串");
|
||||
}
|
||||
|
||||
export function reset401Flag() {
|
||||
|
||||
Reference in new issue
Block a user