From 9ae643e40e29f15e97bd411b59d4afe808e9300f Mon Sep 17 00:00:00 2001 From: Estrella Pan Date: Sun, 25 Jan 2026 09:47:50 +0100 Subject: [PATCH] fix(ui): show anime name with season in downloader page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When save_path ends with a season-only folder (Season 1, S01, 第1季), display "Anime Name / Season 1" instead of just "Season 1" Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 1 + webui/src/store/downloader.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a4b1ef1..14d029da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - 规则编辑器新增剧集偏移字段和「自动检测」按钮 - 新增 i18n 翻译(中文/英文) - 优化规则编辑弹窗布局:统一表单字段对齐、统一按钮高度、修复移动端底部弹窗 z-index 层级问题 +- 修复下载器页面仅显示季度文件夹名的问题,现在会显示「番剧名 / Season 1」格式 --- diff --git a/webui/src/store/downloader.ts b/webui/src/store/downloader.ts index 718e9853..ef5ca9aa 100644 --- a/webui/src/store/downloader.ts +++ b/webui/src/store/downloader.ts @@ -16,9 +16,16 @@ export const useDownloaderStore = defineStore('downloader', () => { } const result: TorrentGroup[] = []; + // Regex to detect season-only folder names like "Season 1", "S01", "第1季", etc. + const seasonOnlyRegex = /^(Season\s*\d+|S\d+|第\d+季)$/i; + for (const [savePath, items] of map) { - const parts = savePath.replace(/\/$/, '').split('/'); - const name = parts[parts.length - 1] || savePath; + const parts = savePath.replace(/\/$/, '').split('/').filter(Boolean); + let name = parts[parts.length - 1] || savePath; + // If the last part is just a season folder, include the parent folder too + if (parts.length >= 2 && seasonOnlyRegex.test(name)) { + name = `${parts[parts.length - 2]} / ${name}`; + } const totalSize = items.reduce((sum, t) => sum + t.size, 0); const overallProgress = totalSize > 0 @@ -65,7 +72,7 @@ export const useDownloaderStore = defineStore('downloader', () => { opts ); const { execute: deleteSelected } = useApi( - (deleteFiles: boolean = false) => + (deleteFiles = false) => apiDownloader.deleteTorrents(selectedHashes.value, deleteFiles), opts );