Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error caused by Filelist type #526

Closed
gustavomrfz opened this issue Dec 13, 2015 · 13 comments
Closed

Error caused by Filelist type #526

gustavomrfz opened this issue Dec 13, 2015 · 13 comments
Labels

Comments

@gustavomrfz
Copy link

@gustavomrfz gustavomrfz commented Dec 13, 2015

When getting a Filelist on Chromium/Firefox works properly, but not in Electron (0.36.0) with same functions and modules version.

var webtorrent = require('webtorrent')

this.torrentUpload =  function (){
            files = this.files
            player.startSeeding(files)
}
this.startSeeding = function (files) {

   // If I put files.shift() in here, launches error on the browsers also

    $.each(files,function (i,file) {
             client.seed(file, {dht: false},  onTorrent)  
             // Doesn't launch errors on browsers. 
             // Launches error with Electron
      }
}

The error is:

104 Uncaught (in promise) TypeError: item.path.shift is not a function(…)

could be found at:

create-torrent/index.js

 if (commonPrefix) {
    input.forEach(function (item) {
      if (typeof item === 'string') return
      item.path.shift()
    })

I understand that Filelist is not a proper array for shift(), but I belive that It would be fine that Webtorrent could parse files as good in Electron as in Chromium.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 1, 2016

@jhiesey Another issue related to the change we made to create-torrent together.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 1, 2016

@gustavomrfz Actually, can you try this again using the latest version of WebTorrent? We may have fixed this issue in the latest version of create-torrent (3.20.2).

@gustavomrfz

This comment has been minimized.

Copy link
Author

@gustavomrfz gustavomrfz commented Jan 1, 2016

@feross I tried again with webtorrent 0.67.1 but the issue still persits.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 2, 2016

@gustavomrfz Can you try again with 0.68.0? There's a chance that it's fixed now.

If it's still not, I'll make a sample Electron app and debug this.

@gustavomrfz

This comment has been minimized.

Copy link
Author

@gustavomrfz gustavomrfz commented Jan 2, 2016

@feross Still not.

I realize that file objects created by file input forms are not the same type in browser than in Electron. Object that Electron makes doesn't have shift() function even when elements are taken individually from a function as $.each(). I belive the issue comes by that way.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 2, 2016

@gustavomrfz Btw, how have you managed to get drag and drop working in an Electron app? The drag-drop module doesn't seem to work because of this chromium bug: https://code.google.com/p/chromium/issues/detail?id=412373

@gustavomrfz

This comment has been minimized.

Copy link
Author

@gustavomrfz gustavomrfz commented Jan 2, 2016

@feross I'm not using drag and drop, but "classical" input. Indeed, it didn't work when I tried.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 3, 2016

drag-drop actually works just fine. I was doing something silly before

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 3, 2016

The issue in create-torrent is fixed now, so webtorrent.seed works correctly in Electron now!

This is the relevant commit: webtorrent/create-torrent@89eeed3

@feross feross closed this Jan 3, 2016
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 3, 2016

@feross Was having this issue too in Electron! Awesome, closer and closer.

@gustavomrfz

This comment has been minimized.

Copy link
Author

@gustavomrfz gustavomrfz commented Jan 3, 2016

@feross Thanks a lot!

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 3, 2016

No problem guys 👍

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 5, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.