From 26c67001520203c7f008af8081ec9fe15ef8ffe5 Mon Sep 17 00:00:00 2001 From: hicccc77 <98377878+hicccc77@users.noreply.github.com> Date: Sat, 28 Mar 2026 21:12:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20CodeQL=20code=20sca?= =?UTF-8?q?nning=20warning=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/annualReportService.ts | 2 +- electron/services/chatService.ts | 2 +- electron/services/imageDecryptService.ts | 4 ++-- src/pages/ChatPage.tsx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/electron/services/annualReportService.ts b/electron/services/annualReportService.ts index e6e0967..3020b4c 100644 --- a/electron/services/annualReportService.ts +++ b/electron/services/annualReportService.ts @@ -1135,7 +1135,7 @@ class AnnualReportService { const now = Date.now() if (now - lastProgressAt > 200) { - let progress = 30 + let progress: number if (totalMessagesForProgress > 0) { const ratio = Math.min(1, processedMessages / totalMessagesForProgress) progress = 30 + Math.floor(ratio * 50) diff --git a/electron/services/chatService.ts b/electron/services/chatService.ts index 25be33d..6069c38 100644 --- a/electron/services/chatService.ts +++ b/electron/services/chatService.ts @@ -2009,7 +2009,7 @@ class ChatService { selectableColumns = resolvedColumns } - if (!selectableColumns || selectableColumns.length === 0) return rows + if (selectableColumns.length === 0) return rows const selectColumns = ['username', ...selectableColumns] const sql = `SELECT ${selectColumns.map((column) => this.quoteSqlIdentifier(column)).join(', ')} FROM contact WHERE username IS NOT NULL AND username != ''` diff --git a/electron/services/imageDecryptService.ts b/electron/services/imageDecryptService.ts index a16ef52..5dfe612 100644 --- a/electron/services/imageDecryptService.ts +++ b/electron/services/imageDecryptService.ts @@ -562,14 +562,14 @@ export class ImageDecryptService { if (allowThumbnail || !isThumb) { this.logInfo('[ImageDecrypt] hardlink hit (datName)', { imageMd5: imageDatName, path: preferredPath }) this.cacheDatPath(accountDir, imageDatName, preferredPath) - if (imageMd5) this.cacheDatPath(accountDir, imageMd5, preferredPath) + this.cacheDatPath(accountDir, imageMd5, preferredPath) return preferredPath } // 找到缩略图但要求高清图,尝试同目录查找高清图变体 const hdPath = this.findHdVariantInSameDir(preferredPath) if (hdPath) { this.cacheDatPath(accountDir, imageDatName, hdPath) - if (imageMd5) this.cacheDatPath(accountDir, imageMd5, hdPath) + this.cacheDatPath(accountDir, imageMd5, hdPath) return hdPath } return null diff --git a/src/pages/ChatPage.tsx b/src/pages/ChatPage.tsx index e9f8eda..2abc958 100644 --- a/src/pages/ChatPage.tsx +++ b/src/pages/ChatPage.tsx @@ -3227,7 +3227,7 @@ function ChatPage(props: ChatPageProps) { const session = sessionMapRef.current.get(sessionId) const unreadCount = session?.unreadCount ?? 0 - let messageLimit = currentBatchSizeRef.current + let messageLimit: number if (offset === 0) { const preferredLimit = Number.isFinite(options.forceInitialLimit) @@ -7901,7 +7901,7 @@ function MessageBubble({ useEffect(() => { if (emojiLocalPath) return // 后端已从本地缓存找到文件(转发表情包无 CDN URL 的情况) - if (isEmoji && message.emojiLocalPath && !emojiLocalPath) { + if (isEmoji && message.emojiLocalPath) { captureEmojiResizeBaseline() setEmojiLocalPath(message.emojiLocalPath) return