fix(download): support full directory traversal when sending to Aria2#300
Open
himulawang wants to merge 1 commit into
Open
fix(download): support full directory traversal when sending to Aria2#300himulawang wants to merge 1 commit into
himulawang wants to merge 1 commit into
Conversation
to the Aria2 queue when selecting a directory. - Implemented a pagination loop in fetchFolderStructure to recursively retrieve all files across all pages. - Replaced the hardcoded page size with getPagination().size to sync with the Admin "default_page_size" setting. - Ensures that all items in a directory and its sub-directories are correctly sent to Aria2 regardless of the total file count.
β Deploy Preview for alist-web ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Problem
Currently, when a user selects a directory and clicks "Send To Aria2", Alist only adds the first page of files (default 50) to the Aria2 download queue. Any files beyond the first page are ignored, requiring users to manually add the remaining files, which is inconvenient for large directories.
This occurs because the
fetchFolderStructurefunction inuseDownload.tscalls thefsListAPI without handling pagination, thus only receiving the first response payload.The Solution
fetchFolderStructureto include awhileloop that continues to request the next page of the directory content until all files and sub-directories are retrieved.getPagination().sizefrom the settings store. This ensures the "Send To Aria2" functionality respects thedefault_page_sizeconfigured in the Admin settings and adheres to the system'sMAX_PAGE_SIZElimit.Steps to Reproduce
Implementation Details
src/hooks/useDownload.tspagecounter and awhileloop insidefetchFolderStructure.if (content.length < perPage) break;.getPagination()from~/store/settingsto determineperPage.Verification & Test Plan
β Manual Testing
default_page_sizein Admin settingsfs/listrequest'sper_pageparameter updated accordingly.β Technical Verification
fs/listrequests are triggered with incrementingpageparameters (page=1,page=2, etc.) until the full list is fetched.