This commit is contained in:
@@ -494,6 +494,11 @@ uploadForm.addEventListener('submit', async (e) => {
|
||||
body: formData,
|
||||
});
|
||||
clearInterval(timer);
|
||||
const ct = (resp.headers.get('content-type') || '').toLowerCase();
|
||||
if (!ct.includes('application/json')) {
|
||||
const text = await resp.text();
|
||||
throw new Error(text ? String(text).slice(0, 200) : `HTTP ${resp.status}`);
|
||||
}
|
||||
const data = await resp.json();
|
||||
if (!resp.ok || data.status !== 'success') {
|
||||
throw new Error(data.message || '上传识别失败');
|
||||
|
||||
Reference in New Issue
Block a user