Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix invalid download path with single-file torrents #651

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

Sculas
Copy link
Contributor

@Sculas Sculas commented Jan 5, 2025

Fixes #648.

You can't have multiple files at the root of a torrent. It's either a single file or a directory containing multiple files.
AllDebrid goes along with this and doesn't place torrents in a directory if it only contains a single file. RDT didn't handle this case.

This was fine, except for the people using AllDebrid with the rclone/symlink downloader. People using the other downloaders would've noticed that their files got placed into a directory with the same name as the file it contains, which shouldn't happen.

I've tested this with AllDebrid and the internal downloader using a single-file torrent and a multi-file torrent,
<nyaa dot si>/view/1806288 and <nyaa dot si>/view/1350495 respectively. The single-file torrent was placed in /data/downloads/FILE.mkv, and the files and directories of the multi-file torrent were placed in /data/downloads/TORRENTNAME/, which is what I expected to see.

@Cucumberrbob @bob1321 Can you please let me know if this has fixed your issue? I believe it should've.
@rogerfar, or anyone with access to RealDebrid, can you check if this still works as expected for you?
If not, we may have to add a check for AllDebrid and only do this when AllDebrid is used to download the torrent.

@rogerfar rogerfar merged commit e700939 into rogerfar:master Jan 5, 2025
@Sculas Sculas deleted the fix/path-single-file-torrent branch January 5, 2025 23:17
@Cucumberrbob
Copy link

Cucumberrbob commented Jan 6, 2025

The single file torrent you've tested with actually does have the same filename, even though its title on nyaa is different from the file inside's name. The behavior I'm trying to describe happens when the /v4/magnets/status response has a mismatch between the top level filename and the n of the file. The /v4/magnets/status for <nyaa dot si>/view/1806288 looks like

{
    "data": {
        "magnets": {
            "filename": "[2007F032].mkv", // <--- this is the same as links[0].files[0].n - there is no mismatch
            "links": [
                {
                    "filename": "[2007F032].mkv",
                    "files": [
                        {
                            "n": "[2007F032].mkv"
                        }
                    ]
                }
            ]
        }
    }
}

Name Mismatch (Single File).torrent.zip is a single file torrent I've uploaded to AD which demonstrates this mismatch behavior for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alldebrid puts files in silly places sometimes, causing rdt-client to be unable to find them
3 participants