Seeding: sort files by path (#663)

Fixes a bug where you could create duplicate torrents by adding the same folder multiple times, because the file order & therefore the infohash was nondeterministic
This commit is contained in:
DC
2016-06-23 02:14:23 -07:00
committed by GitHub
parent 1af7e4ef19
commit 06d3bd3f93

View File

@@ -756,6 +756,7 @@ function findFilesRecursive (paths, cb) {
findFilesRecursive([path], function (fileObjs) {
ret = ret.concat(fileObjs)
if (++numComplete === paths.length) {
ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path)
cb(ret)
}
})