From 1a2e895245d143145438e0b930d5e4bef488375a Mon Sep 17 00:00:00 2001 From: Dr_rOot Date: Thu, 5 Nov 2026 00:09:50 +0800 Subject: [PATCH 1/2] fix(rpc): resolve nested output paths under download directory Restore directory-relative HTTP/FTP out semantics for cloud-drive clients that send leading-slash paths. Preserve absolute BitTorrent index-out mappings and apply the same rule when changing task options. Add native and real-engine regressions for nested directories, Unicode names, SQLite restart recovery, and absolute torrent mappings. Refs: agalwood/Motrix#2502 --- .github/workflows/ci.yml | 9 ++ src/RpcMethodImpl.cc | 3 +- src/download_helper.cc | 2 +- src/util.cc | 10 ++- src/util.h | 5 +- test/DownloadHelperTest.cc | 18 ++++ test/UtilTest2.cc | 10 +++ test/e2e/nested-output.e2e.test.mjs | 127 ++++++++++++++++++++++++++++ 8 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 test/e2e/nested-output.e2e.test.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 950d943566..8fa720335e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,6 +118,11 @@ jobs: env: ARIA2_E2E_BIN: ${{ github.workspace }}/src/aria2c run: node --test test/e2e/select-dns.e2e.test.mjs + - name: Verify nested cloud-drive output paths + if: matrix.bittorrent == 'with-bt' + env: + ARIA2_E2E_BIN: ${{ github.workspace }}/src/aria2c + run: node --test test/e2e/nested-output.e2e.test.mjs - name: Verify legacy recovery and schema upgrade snapshots if: matrix.bittorrent == 'with-bt' env: @@ -228,6 +233,10 @@ jobs: env: ARIA2_E2E_BIN: ${{ github.workspace }}\bin\aria2c.exe run: node --test test/e2e/select-dns.e2e.test.mjs + - name: Verify nested cloud-drive output paths + env: + ARIA2_E2E_BIN: ${{ github.workspace }}\bin\aria2c.exe + run: node --test test/e2e/nested-output.e2e.test.mjs - name: Verify native HTTP redirect policy env: ARIA2_E2E_BIN: ${{ github.workspace }}\bin\aria2c.exe diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index 72e481eaa2..8bf1d5504f 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -2383,7 +2383,8 @@ void changeOption(const std::shared_ptr& group, if (!grOption->blank(PREF_OUT)) { fileEntry->setPath( - util::applyDir(grOption->get(PREF_DIR), grOption->get(PREF_OUT))); + util::applyDir(grOption->get(PREF_DIR), grOption->get(PREF_OUT), + false)); fileEntry->setSuffixPath(A2STR::NIL); } else if (fileEntry->getSuffixPath().empty()) { diff --git a/src/download_helper.cc b/src/download_helper.cc index 79f757ecad..1c4706a845 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -139,7 +139,7 @@ createRequestGroup(const std::shared_ptr