Implement custom download directory management and path mirroring - #1718
Open
Okashichan wants to merge 12 commits into
Open
Implement custom download directory management and path mirroring#1718Okashichan wants to merge 12 commits into
Okashichan wants to merge 12 commits into
Conversation
- Sanitized custom destination directories to prevent arbitrary file writes via path traversal (..) - Stripped '.' and '..' from remote paths when mirroring to prevent malicious remote paths from escaping the downloads directory - Refined the '@' folder stripping logic to require an exact '@username' match, preventing legitimate folders like '@music' from being accidentally removed.
Member
|
Thanks for the PR. I appreciate the effort, but merging would conflict with a different solution I'll be adding shortly. |
Author
|
Either way, I'm just glad it will be resolved. Thank you for your hard work! |
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.
Overview
This PR implements a comprehensive suite of features for managing download directory structures, as discussed in Issue #1584. It addresses several long-standing requests regarding path mirroring, username isolation, and custom destination routing.
Key Changes
root,subfolder(default), andmirrorformats for both completed and incomplete downloads:download_directory_format,incomplete_directory_format.download_strip_leading_directoriesoption to prune unwanted segments from mirrored paths.include_username_in_download_pathoption to prefix download paths with the remote user's username.overwrite_existing_filesoption to overwrite existing files in the downloads directory instead of appending numeric suffixes.Linked Issues
Closes #1584
Relates to #1499, #1362, #1202, #704, #405, #401
AI Disclosure
DownloadService.csandCommonExtensions.cs.Directory.jsxandResponse.jsx.src/slskd/Core/Data/Migrations/.I have fully reviewed all code produced and take responsibility for its quality and adherence to the project's standards. BUT this code must be reviewed very carefully by maintainers, as I am not a C# developer myself. It resolves some issues that I found really annoying, and, as far as I could test, it works for me.
Nevertheless, you have the right to reject it completely, since it was mostly written with the help of AI.