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 for nexusphp tracker #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bittorrent/torrent_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,16 @@ func (t *TorrentFile) Download() ([]byte, error) {
}

// Try to download file
parts := strings.Split(t.URI, "|")
parts := strings.Split(t.URI, "|") // Burst passes headers by adding |key=value to URL
uri := parts[0]
if len(parts) > 1 {
// NexusPHP tracker adds private token to URL like this: URL|token, so we should keep it
// we do this only for the first "part" and only if there is no "=" in it (so it is not from Burst)
if !strings.Contains(parts[1], "=") {
uri += "|" + parts[1]
log.Debugf("Added private token %q back to URL", parts[1])
}
}
req, err := http.NewRequest("GET", uri, nil)
if err != nil {
return nil, err
Expand Down