From 06d3bd3f93b49112aefd3415fe3cb10d01c7c1f7 Mon Sep 17 00:00:00 2001 From: DC Date: Thu, 23 Jun 2016 02:14:23 -0700 Subject: [PATCH] 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 --- renderer/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/renderer/main.js b/renderer/main.js index 6a759d1d..7c85e8ab 100644 --- a/renderer/main.js +++ b/renderer/main.js @@ -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) } })