mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: 网络视频后缀识别
fix: 网络文件下载失败的错误提示
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 4,
|
"manifest_version": 4,
|
||||||
"type": "extension",
|
"type": "extension",
|
||||||
"name": "LLOneBot v3.13.6",
|
"name": "LLOneBot v3.13.7",
|
||||||
"slug": "LLOneBot",
|
"slug": "LLOneBot",
|
||||||
"description": "LiteLoaderQQNT的OneBotApi",
|
"description": "LiteLoaderQQNT的OneBotApi",
|
||||||
"version": "3.13.6",
|
"version": "3.13.7",
|
||||||
"thumbnail": "./icon.png",
|
"thumbnail": "./icon.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -330,7 +330,10 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
const file = sendMsg.data?.file
|
const file = sendMsg.data?.file
|
||||||
const payloadFileName = sendMsg.data?.name
|
const payloadFileName = sendMsg.data?.name
|
||||||
if (file) {
|
if (file) {
|
||||||
const {path, isLocal, fileName} = (await uri2local(file))
|
const {path, isLocal, fileName, errMsg} = (await uri2local(file))
|
||||||
|
if (errMsg){
|
||||||
|
throw errMsg
|
||||||
|
}
|
||||||
if (path) {
|
if (path) {
|
||||||
if (!isLocal) { // 只删除http和base64转过来的文件
|
if (!isLocal) { // 只删除http和base64转过来的文件
|
||||||
deleteAfterSentFiles.push(path)
|
deleteAfterSentFiles.push(path)
|
||||||
|
@@ -33,7 +33,13 @@ export async function uri2local(uri: string, fileName: string = null) {
|
|||||||
}
|
}
|
||||||
} else if (url.protocol == "http:" || url.protocol == "https:") {
|
} 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) {
|
if (!fetchRes.ok) {
|
||||||
res.errMsg = `${url}下载失败,` + fetchRes.statusText
|
res.errMsg = `${url}下载失败,` + fetchRes.statusText
|
||||||
return res
|
return res
|
||||||
@@ -46,7 +52,7 @@ export async function uri2local(uri: string, fileName: string = null) {
|
|||||||
fileName = pathInfo.name
|
fileName = pathInfo.name
|
||||||
if (pathInfo.ext){
|
if (pathInfo.ext){
|
||||||
fileName += pathInfo.ext
|
fileName += pathInfo.ext
|
||||||
res.ext = pathInfo.ext
|
// res.ext = pathInfo.ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.fileName = fileName
|
res.fileName = fileName
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const version = "3.13.6"
|
export const version = "3.13.7"
|
Reference in New Issue
Block a user