fix: 修复图像解密服务中的潜在错误

This commit is contained in:
Forrest
2026-01-17 01:52:56 +08:00
parent f97e102dbd
commit 6707be2200

View File

@@ -936,6 +936,18 @@ export class ImageDecryptService {
extensions: string[],
preferHd: boolean
): string | null {
// 先检查并删除旧的 .hevc 文件ffmpeg 转换失败时遗留的)
const hevcThumb = join(dirPath, `${normalizedKey}_thumb.hevc`)
const hevcHd = join(dirPath, `${normalizedKey}_hd.hevc`)
try {
if (existsSync(hevcThumb)) {
require('fs').unlinkSync(hevcThumb)
}
if (existsSync(hevcHd)) {
require('fs').unlinkSync(hevcHd)
}
} catch { }
for (const ext of extensions) {
if (preferHd) {
const hdPath = join(dirPath, `${normalizedKey}_hd${ext}`)