mirror of
https://github.com/rumanzo/bt2qbt.git
synced 2024-11-22 10:22:38 +01:00
We can't trust anyone when splitting paths. Path separator may be / and may be \
This commit is contained in:
parent
96ed446c41
commit
f421df467c
@ -253,7 +253,12 @@ func (newstructure *NewTorrentStructure) FillSavePaths() {
|
|||||||
torrentname = newstructure.TorrentFile["info"].(map[string]interface{})["name"].(string)
|
torrentname = newstructure.TorrentFile["info"].(map[string]interface{})["name"].(string)
|
||||||
}
|
}
|
||||||
origpath := newstructure.Path
|
origpath := newstructure.Path
|
||||||
dirpaths := strings.Split(origpath, "\\")
|
var dirpaths []string
|
||||||
|
if contains := strings.Contains(origpath, "\\"); contains {
|
||||||
|
dirpaths = strings.Split(origpath, "\\")
|
||||||
|
} else {
|
||||||
|
dirpaths = strings.Split(origpath, "/")
|
||||||
|
}
|
||||||
lastdirname := dirpaths[len(dirpaths)-1]
|
lastdirname := dirpaths[len(dirpaths)-1]
|
||||||
if newstructure.HasFiles {
|
if newstructure.HasFiles {
|
||||||
if lastdirname == torrentname {
|
if lastdirname == torrentname {
|
||||||
|
Loading…
Reference in New Issue
Block a user