fix: 修复 CodeQL code scanning warning 问题

This commit is contained in:
hicccc77
2026-03-28 21:12:29 +08:00
parent 49fb96d7a3
commit 26c6700152
4 changed files with 6 additions and 6 deletions

View File

@@ -1135,7 +1135,7 @@ class AnnualReportService {
const now = Date.now() const now = Date.now()
if (now - lastProgressAt > 200) { if (now - lastProgressAt > 200) {
let progress = 30 let progress: number
if (totalMessagesForProgress > 0) { if (totalMessagesForProgress > 0) {
const ratio = Math.min(1, processedMessages / totalMessagesForProgress) const ratio = Math.min(1, processedMessages / totalMessagesForProgress)
progress = 30 + Math.floor(ratio * 50) progress = 30 + Math.floor(ratio * 50)

View File

@@ -2009,7 +2009,7 @@ class ChatService {
selectableColumns = resolvedColumns selectableColumns = resolvedColumns
} }
if (!selectableColumns || selectableColumns.length === 0) return rows if (selectableColumns.length === 0) return rows
const selectColumns = ['username', ...selectableColumns] const selectColumns = ['username', ...selectableColumns]
const sql = `SELECT ${selectColumns.map((column) => this.quoteSqlIdentifier(column)).join(', ')} FROM contact WHERE username IS NOT NULL AND username != ''` const sql = `SELECT ${selectColumns.map((column) => this.quoteSqlIdentifier(column)).join(', ')} FROM contact WHERE username IS NOT NULL AND username != ''`

View File

@@ -562,14 +562,14 @@ export class ImageDecryptService {
if (allowThumbnail || !isThumb) { if (allowThumbnail || !isThumb) {
this.logInfo('[ImageDecrypt] hardlink hit (datName)', { imageMd5: imageDatName, path: preferredPath }) this.logInfo('[ImageDecrypt] hardlink hit (datName)', { imageMd5: imageDatName, path: preferredPath })
this.cacheDatPath(accountDir, imageDatName, preferredPath) this.cacheDatPath(accountDir, imageDatName, preferredPath)
if (imageMd5) this.cacheDatPath(accountDir, imageMd5, preferredPath) this.cacheDatPath(accountDir, imageMd5, preferredPath)
return preferredPath return preferredPath
} }
// 找到缩略图但要求高清图,尝试同目录查找高清图变体 // 找到缩略图但要求高清图,尝试同目录查找高清图变体
const hdPath = this.findHdVariantInSameDir(preferredPath) const hdPath = this.findHdVariantInSameDir(preferredPath)
if (hdPath) { if (hdPath) {
this.cacheDatPath(accountDir, imageDatName, hdPath) this.cacheDatPath(accountDir, imageDatName, hdPath)
if (imageMd5) this.cacheDatPath(accountDir, imageMd5, hdPath) this.cacheDatPath(accountDir, imageMd5, hdPath)
return hdPath return hdPath
} }
return null return null

View File

@@ -3227,7 +3227,7 @@ function ChatPage(props: ChatPageProps) {
const session = sessionMapRef.current.get(sessionId) const session = sessionMapRef.current.get(sessionId)
const unreadCount = session?.unreadCount ?? 0 const unreadCount = session?.unreadCount ?? 0
let messageLimit = currentBatchSizeRef.current let messageLimit: number
if (offset === 0) { if (offset === 0) {
const preferredLimit = Number.isFinite(options.forceInitialLimit) const preferredLimit = Number.isFinite(options.forceInitialLimit)
@@ -7901,7 +7901,7 @@ function MessageBubble({
useEffect(() => { useEffect(() => {
if (emojiLocalPath) return if (emojiLocalPath) return
// 后端已从本地缓存找到文件(转发表情包无 CDN URL 的情况) // 后端已从本地缓存找到文件(转发表情包无 CDN URL 的情况)
if (isEmoji && message.emojiLocalPath && !emojiLocalPath) { if (isEmoji && message.emojiLocalPath) {
captureEmojiResizeBaseline() captureEmojiResizeBaseline()
setEmojiLocalPath(message.emojiLocalPath) setEmojiLocalPath(message.emojiLocalPath)
return return