From 9ed0704c5bc26d163747e1762942882ff666cf7d Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 20 Jul 2026 15:35:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E8=AF=86=E5=88=AB=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=97=A7=E4=B8=8B=E8=BD=BD=E5=99=A8=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/transfer.py | 4 ++-- tests/test_transfer_history_retransfer.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/endpoints/transfer.py b/app/api/endpoints/transfer.py index 996d1ecf..8f38db99 100644 --- a/app/api/endpoints/transfer.py +++ b/app/api/endpoints/transfer.py @@ -269,8 +269,8 @@ def manual_transfer( ) # 强制转移 force = True - downloader = history.downloader - # 仅复用历史识别信息时才传入旧 Hash,否则由当前文件路径重新匹配下载记录。 + # 下载器与 Hash 是同一组下载上下文,重新识别时由当前文件路径重新匹配。 + downloader = history.downloader if transer_item.from_history else None download_hash = history.download_hash if transer_item.from_history else None if history.status and ("move" in history.mode): # 重新整理成功的转移,则使用成功的 dest 做 in_path diff --git a/tests/test_transfer_history_retransfer.py b/tests/test_transfer_history_retransfer.py index d4636b5d..3134683e 100644 --- a/tests/test_transfer_history_retransfer.py +++ b/tests/test_transfer_history_retransfer.py @@ -55,7 +55,7 @@ def test_manual_transfer_from_history_preserves_download_context(monkeypatch): def test_manual_transfer_without_history_recognition_ignores_old_hash(monkeypatch): - """从历史重新识别时应忽略旧 Hash,但保留下载器上下文。""" + """从历史重新识别时应忽略旧下载上下文。""" history = SimpleNamespace( status=0, mode="copy", @@ -101,7 +101,7 @@ def test_manual_transfer_without_history_recognition_ignores_old_hash(monkeypatc ) assert resp.success is True - assert captured["downloader"] == "qbittorrent" + assert captured["downloader"] is None assert captured["download_hash"] is None assert captured["tmdbid"] is None assert captured["doubanid"] is None