Merge pull request #754 from NapNeko/qrcode-refactor

fix: thumb残留
This commit is contained in:
手瓜一十雪
2025-02-03 14:11:22 +08:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@@ -181,9 +181,12 @@ export class NTQQFileApi {
this.context.logger.logError('复制自定义缩略图失败', e); this.context.logger.logError('复制自定义缩略图失败', e);
} }
} }
context.deleteAfterSentFiles.push(thumbPath);
const thumbSize = (await fsPromises.stat(thumbPath)).size; const thumbSize = (await fsPromises.stat(thumbPath)).size;
const thumbMd5 = await calculateFileMD5(thumbPath); const thumbMd5 = await calculateFileMD5(thumbPath);
context.deleteAfterSentFiles.push(path); context.deleteAfterSentFiles.push(thumbPath);
const uploadName = (fileName || _fileName).toLocaleLowerCase().endsWith(`.${fileExt.toLocaleLowerCase()}`) ? (fileName || _fileName) : `${fileName || _fileName}.${fileExt}`; const uploadName = (fileName || _fileName).toLocaleLowerCase().endsWith(`.${fileExt.toLocaleLowerCase()}`) ? (fileName || _fileName) : `${fileName || _fileName}.${fileExt}`;
return { return {

View File

@@ -535,8 +535,12 @@ export class OneBotMsgApi {
let thumb = sendMsg.data.thumb; let thumb = sendMsg.data.thumb;
if (thumb) { if (thumb) {
const uri2LocalRes = await uriToLocalFile(this.core.NapCatTempPath, thumb); const uri2LocalRes = await uriToLocalFile(this.core.NapCatTempPath, thumb);
if (uri2LocalRes.success) thumb = uri2LocalRes.path; if (uri2LocalRes.success) {
thumb = uri2LocalRes.path;
context.deleteAfterSentFiles.push(thumb);
}
} }
return await this.core.apis.FileApi.createValidSendVideoElement(context, path, fileName, thumb); return await this.core.apis.FileApi.createValidSendVideoElement(context, path, fileName, thumb);
}, },