fent/node-torrent

`length` is not a positive integer in file

youri-tolstoy-cko opened this issue · 3 comments

Hi,

Thanks for this great work it helps a lot; it's so useful to don't reinvent the wheel... So I'm writing you because I'm facing an issue ! It seems that sometimes some torrents throws an error but works in my torrent client.

As an example I've printed the exception with the file object details in it:

SchemaError: `length` is not a positive integer in file
{"length":0,"path":[[74,117,115,116,32,99,108,105,99,107,32,115,101,116,117,112,46,101,120,101,46,116,120,116]]}

In this case length = 0 and fails this condition in schema.js

if (!util.isInteger(file.length || file.length < 0)) {

What do you think? Do you need more details ?

fent commented

it looks like the line is a mistake/typo, it should be

if (!util.isInteger(file.length) || file.length < 0) {

Yep this was the issue ;) you want a pull request or I let you do it ?
Thanks !

fent commented

a pull request would be nice :)