MStadlmeier / drivesync

Google Drive synchronization for Linux
MIT License
197 stars 26 forks source link

Undefined method error on upload #6

Closed AFLAPPIE closed 6 years ago

AFLAPPIE commented 6 years ago

Hi, when running the application the I get the following error. Uploading file drive/Boeken/aaaaaaaabbbbbbbbbbcccccccccc.pdf ... /home/arnold/drivesync/src/drive_manager.rb:151:in block in folder_with_name': undefined methodfirst' for nil:NilClass (NoMethodError) from /home/arnold/drivesync/src/drive_manager.rb:151:in select' from /home/arnold/drivesync/src/drive_manager.rb:151:infolder_with_name' from /home/arnold/drivesync/src/drive_manager.rb:173:in block in traverse_and_create' from /home/arnold/drivesync/src/drive_manager.rb:171:ineach' from /home/arnold/drivesync/src/drive_manager.rb:171:in traverse_and_create' from /home/arnold/drivesync/src/drive_manager.rb:101:inupload' from /home/arnold/drivesync/src/synchronizer.rb:147:in upload_file' from /home/arnold/drivesync/src/synchronizer.rb:263:inblock in sync' from /home/arnold/drivesync/src/synchronizer.rb:260:in each' from /home/arnold/drivesync/src/synchronizer.rb:260:insync' from /home/arnold/drivesync/src/synchronizer.rb:76:in run' from drivesync.rb:23:insync' from drivesync.rb:58:in `

'

Some background 1) a new user and no experience with ruby 2) I haven't created a full sync with google drive yet. (first time application user) 3) I run the application, a few files are synced. Than I get the error. I run the applicaiton a 2th time, a few files are synced, then again I get the error. It sometimes sync 5-7 files, sometimes 2. 3) To troubleshoot myself I've done a) ruby drivesync.rb reset b) remove the manifest-file and local drive folder (saw this as a solution in an other issue)

Many thanks for your effort.

MStadlmeier commented 6 years ago

Hi and thank you for the detailed error report. Could you navigate to src/drive_manager.rb, insert the following code: puts "Trying to get folder with name: #{name}" after line 150 (in the function "folder_with_name" before the line starting with @folder_cache ), run the software again and post its output?

AFLAPPIE commented 6 years ago

Dear Maximillian,

I ran the application 3 times, please find attached the log files in your mailbox.

I see a pattern. Every time a new directory is created the first file that is committed the application works perfect. The second time a file is committed in that directory there is an error. (3 runs, 3times the same pattern) FYI, No commands where executed between runs.

Kind regards,

MStadlmeier commented 6 years ago

There does indeed seem to be a problem when a new folder with more than one file is created locally. I guess I never noticed it because for me no error occurs, the sync just stops and the file is uploaded in the next sync. I'll look into it and push a fix soon.

MStadlmeier commented 6 years ago

The latest commit on master(1.3.3) fixed the bug. Thanks for reporting this issue!