diff --git a/manifest.json b/manifest.json index f23606c..b05719c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "manifest_version": 4, "type": "extension", - "name": "LLOneBot v3.13.6", + "name": "LLOneBot v3.13.7", "slug": "LLOneBot", "description": "LiteLoaderQQNT的OneBotApi", - "version": "3.13.6", + "version": "3.13.7", "thumbnail": "./icon.png", "authors": [ { diff --git a/src/onebot11/action/SendMsg.ts b/src/onebot11/action/SendMsg.ts index ecb1324..81c4ea5 100644 --- a/src/onebot11/action/SendMsg.ts +++ b/src/onebot11/action/SendMsg.ts @@ -330,7 +330,10 @@ export class SendMsg extends BaseAction { const file = sendMsg.data?.file const payloadFileName = sendMsg.data?.name if (file) { - const {path, isLocal, fileName} = (await uri2local(file)) + const {path, isLocal, fileName, errMsg} = (await uri2local(file)) + if (errMsg){ + throw errMsg + } if (path) { if (!isLocal) { // 只删除http和base64转过来的文件 deleteAfterSentFiles.push(path) diff --git a/src/onebot11/utils.ts b/src/onebot11/utils.ts index d74c254..812e891 100644 --- a/src/onebot11/utils.ts +++ b/src/onebot11/utils.ts @@ -33,7 +33,13 @@ export async function uri2local(uri: string, fileName: string = null) { } } else if (url.protocol == "http:" || url.protocol == "https:") { // 下载文件 - let fetchRes = await fetch(url) + let fetchRes: Response; + try{ + fetchRes = await fetch(url) + }catch (e) { + res.errMsg = `${url}下载失败` + return res + } if (!fetchRes.ok) { res.errMsg = `${url}下载失败,` + fetchRes.statusText return res @@ -46,7 +52,7 @@ export async function uri2local(uri: string, fileName: string = null) { fileName = pathInfo.name if (pathInfo.ext){ fileName += pathInfo.ext - res.ext = pathInfo.ext + // res.ext = pathInfo.ext } } res.fileName = fileName diff --git a/src/version.ts b/src/version.ts index 5633f79..63485bf 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const version = "3.13.6" \ No newline at end of file +export const version = "3.13.7" \ No newline at end of file