mozilla / makedrive

[RETIRED] Webmaker Filesystem
Mozilla Public License 2.0
352 stars 33 forks source link

Cannot read property 'path' of undefined when trying to sync conflicted copy #393

Closed alicoding closed 10 years ago

alicoding commented 10 years ago
Uncaught TypeError: Cannot read property 'path' of undefined makedrive.js:1676
diffsForFile makedrive.js:1676
(anonymous function) makedrive.js:1748
complete makedrive.js:7308
check_result makedrive.js:6927
(anonymous function) makedrive.js:4968
onsuccess makedrive.js:7772

diff.js

function diffsForLink(checksumNode, callback) {
 var checksumNodePath = checksumNode.path; // here
alicoding commented 10 years ago

I think even if we don't want to allow people to sync a conflicted copy that was not rename we should be careful about this which leads to a bad state https://github.com/mozilla/makedrive/pull/375#issuecomment-58284884

humphd commented 10 years ago

This could be the stuff I did removing contents from errors we send back to the client--maybe I deleted too much and also removed a path?

alicoding commented 10 years ago

There are few problems in this bug.

~1. We need to make sure we check for checksumList before we even calculate diffs.

Doing this

  if(!checksumList.length) {
    return callback(null, diffList);
  }

~2. We should not record the paths when we make changes to a conflicted copy with the exception being rename.

alicoding commented 10 years ago

After fixing the first problem then we're seeing this:

Something errored! Here it is:  Error: Could not sync filesystem from server... trying again {stack: (...), message: "Could not sync filesystem from server... trying again"} main.js:80
sync error:  Error: Failed to sync with the server. Current step is: FAILED. Current state is: SYNC IN PROGRESS
    at handleError (http://localhost:8003/thirdparty/makedrive/client/dist/makedrive.js:630:26)
    at handleMessage (http://localhost:8003/thirdparty/makedrive/client/dist/makedrive.js:648:5)
    at WebSocket.SyncManager.init.socket.onmessage (http://localhost:8003/thirdparty/makedrive/client/dist/makedrive.js:920:9) MakeDriveFileSystem.js:52
Something errored! Here it is:  Error: Failed to sync with the server. Current step is: FAILED. Current state is: SYNC IN PROGRESS {stack: (...), message: "Failed to sync with the server. Current step is: FAILED. Current state is: SYNC IN PROGRESS"}