Skip to content

Commit

Permalink
Fix bug in hash-based duplicate detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mmgoodnow committed Jun 9, 2020
1 parent 87b0e0b commit eeeeb73
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,16 @@ async function assessResult(result, ogInfo, hashesToExclude) {
const resultInfo = await parseTorrentRemote(result.Link);
if (resultInfo.length !== ogInfo.length) return null;
const name = resultInfo.name;
const announce1 = ogInfo.announce[0];
const announce2 = resultInfo.announce[0];
const ogAnnounce = ogInfo.announce[0];
const newAnnounce = resultInfo.announce[0];

if (hashesToExclude.includes(resultInfo.infoHash)) {
console.log(`hash match for ${name} at ${announce1}`)
console.log(`hash match for ${name} at ${newAnnounce}`);
return null;
}

if (!compareFileTrees(resultInfo.files, ogInfo.files)) {
console.log(`trees differ for ${name}: ${announce1}, ${announce2}}`);
console.log(`trees differ for ${name}: ${ogAnnounce}, ${newAnnounce}}`);
return null;
}

Expand Down

0 comments on commit eeeeb73

Please sign in to comment.