Opened 20 months ago

Closed 8 months ago

#2291 closed defect (fixed)

I2PSnark corrupts torrents downloaded with the same filename

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


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.


Change History (8)

comment:1 Changed 20 months ago by zzz

Status: newaccepted

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 20 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 20 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 20 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 20 months ago by zzz

Milestone: undecided0.9.37

comment:6 Changed 19 months ago by zzz

Milestone: 0.9.370.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?

comment:7 Changed 9 months ago by zzz

Milestone: 0.9.380.9.42
Sensitive: unset

comment:8 Changed 8 months ago by zzz

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.