Opened 10 months ago

Last modified 8 months ago

#2291 accepted defect

I2PSnark corrupts torrents downloaded with the same filename

Reported by: Reportage Owned by: zzz
Priority: major Milestone: 0.9.38
Component: apps/i2psnark Version: 0.9.35
Keywords: i2psnark, file corruption Cc:
Parent Tickets:


If an existing torrent exists in I2PSnark, and a new torrent is added with the same filename as an existing torrent, I2PSnark doesn't differentiate between the two files, resulting in a corrupted download.

Subtickets (add)

Change History (6)

comment:1 Changed 10 months ago by zzz

  • Status changed from new to accepted

True. I think we had a complaint about this years ago, but don't think there's a ticket. I guess we should compare to all current torrents, which would be O(n), although it would be O(n2) at startup.

Should we rename the base to something different, or just fail?

comment:2 Changed 10 months ago by Reportage

Probably the best response from a user experience perspective is to move both the conflicting torrent and file to a _duplicate_timestamp folder, screenlog the move with the name of the _duplicate folder, and then proceed with the torrent add as normal.

comment:3 Changed 10 months ago by slumlord

Would a Java check for existence of the .torrent file and directory where data will be downloaded to work? Seems like comment 1 is describing comparing all of the existing files/directories manually in a loop.

comment:4 Changed 10 months ago by zzz

you're right, ignore my ramblings about O(n squared), there's plenty of ways to do it, not a serious objection

comment:5 Changed 9 months ago by zzz

  • Milestone changed from undecided to 0.9.37

comment:6 Changed 8 months ago by zzz

  • Milestone changed from 0.9.37 to 0.9.38

notes to self:

  • use SnarkManager?.getTorrentByBaseName() for dup check unless we're adding a HashSet? for base names to avoid the n-squared (TBD)
  • there's already a dup check for the create form
  • places to add check: several in SnarkManager?, one in FetchAndAdd?
Note: See TracTickets for help on using tickets.