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 double decode of file url #144

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion bittorrent/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ func (btp *Player) InitAudio() {

for _, f := range btp.t.files {
if strings.Contains(f.Path, currentPath) && util.HasAudioExt(f.Path) {
collected = append(collected, ip.GetHTTPHost()+"/files/"+f.Path)
collected = append(collected, ip.GetHTTPHost()+"/files/"+util.EncodeFileURL(f.Path))
}
}

Expand Down
1 change: 1 addition & 0 deletions bittorrent/torrent_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ func (t *TorrentFile) Download() ([]byte, error) {
for _, part := range parts[1:] {
if keyVal := strings.SplitN(part, "=", 2); len(keyVal) > 1 {
req.Header.Add(keyVal[0], keyVal[1])
log.Debugf("Added header %q: %q", keyVal[0], keyVal[1])
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions bittorrent/torrentfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ func NewTorrentFS(service *Service, method string) *TorrentFS {
}

// Open ...
func (tfs *TorrentFS) Open(uname string) (http.File, error) {
name := util.DecodeFileURL(uname)

func (tfs *TorrentFS) Open(name string) (http.File, error) {
var file http.File
var err error

Expand Down