Closed fabacab closed 8 years ago
far too late, i'm sorry, this seem to be an actual bug, thanks to report it so accuratly. I'm not maintaining this project as you may have guessed... but i'll accept merge request.
Not sure if I'll have time to write a patch since the easy workaround is to supply directories with files but if I ever come back to that project with enough time I will upstream whatever improvements/fixes I make.
When a root directory that contains more than one descendant directory who, themselves, both share a common parent directory but whose parent has no files, the
Torrent::files
method incorrectly identifies the root directory as one of the descendant directories rather than their shared parent directory.Specifically, given a directory structure like this:
creating a new torrent from either
.
or./child-directory
like so:will create a torrent file whose
info
dictionary only lists the contents ofdescendant-dir2
:This is unexpected behavior. Instead, both the contents of
descendant-dir1
and the contents ofdescendant-dir2
should have been included, withchild-directory
(their common root) being correctly identified as the torrent root.However, if we then add a file inside of
child-directory
, so that our directory tree looks like this:Then the correct root (
child-directory
) is identified: