Delete behaviour

I have two things I’d like to discuss regarding file deletion:

  1. In case of a remote to local delete the file is just deleted locally. Instead, I would like all these files to be moved to the native macOS trash can, except of course for placeholders. The same goes for directories.
    That would be very convenient and feels safer. This is what Google Backup and Sync does.

  2. In case I attempt to delete a file that is not owned by me, odrive gets stuck in a loop of retrying the delete forever.
    I have read Empty trash and sync all deletes - NOT working?, so I know that it’s not odrive’s fault that the call fails. However, instead of retrying forever and spamming the log with lots of repeating messages I think odrive should just restore the file if it is not owned by the current user and write an informative log message.

I am using version 7167 (Mac).

main.log:

06 Oct 04:13:55PM INFO Discovered: Local delete of /Users/richard/odrive/Google Drive/A/B/C/test1.txt. Adding this item to the odrive trash.
06 Oct 04:14:00PM INFO Running automatic trash process.
06 Oct 04:14:00PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:14:15PM INFO Running automatic trash process.
06 Oct 04:14:16PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:14:31PM INFO Running automatic trash process.
06 Oct 04:14:31PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:14:47PM INFO Running automatic trash process.
06 Oct 04:14:47PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:15:02PM INFO Running automatic trash process.
06 Oct 04:15:03PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:15:18PM INFO Running automatic trash process.
06 Oct 04:15:19PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:15:34PM INFO Running automatic trash process.
06 Oct 04:15:35PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:15:50PM INFO Running automatic trash process.
06 Oct 04:15:51PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)
06 Oct 04:16:06PM INFO Running automatic trash process.
06 Oct 04:16:06PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/A/B/C/test1.txt - Size: NA - Date: NA - Error: code GD_EDIT_PERMISSION_DENIED caused by GoogleDriveApiException(httpStatus 403 - {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Insufficient permissions for this file",
    "locationType": "other",
    "location": "file.permissions"
   }
  ],
  "code": 403,
  "message": "Insufficient permissions for this file"
 }
}
 - forbidden)

Hi @richard,
Thanks for the detailed post

  1. This is actually what odrive already does; at least this is what is supposed to be happening. If you are not seeing this, then it is unexpected and we’ll need to dig into it. I just did a number of tests on my MacOS system here and saw the expected results, where any non-placeholder files are moved to the OS trash when a remote->local delete is detected and synced.

If it is a folder that is deleted and it has non-placeholder files in it, the folder and all of its contents will be placed into the OS trash, including placeholders. This is done because the folder move to OS trash is a single operation instead of moving each individual item to the trash.

  1. I will give this some thought. We currently do this for Google Doc files, so maybe we should extend it to all denied attempts due to permissions.

Hi @tony,

Thanks for your quick reply!

  1. Great to hear that it already does this! I checked it again and you are absolutely right, it’s working as intended. I’m so sorry for my incorrect information. I think I got confused because Backup & Sync was also still running at that time. Regarding the folders including placeholders, I fully agree. No problem at all.

  2. Thank you. I now tried this with a Google Doc created by another account in a folder that is shared with me and that I dragged to My Drive in the web client. After odrive synced this folder, I deleted this file. Indeed the file came back so this works as intended.

However, it didn’t work that well after I proceeded by creating a Google Doc from my own account in the same folder, waited for it to sync and finally deleted it. Since I am the owner of this file, I expected it to just sync the delete to remote and be done with it. Instead, the file is still visible in the web client and odrive now keeps logging errors:

06 Oct 11:40:59PM INFO Discovered: Local delete of /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx. Adding this item to the odrive trash.
06 Oct 11:41:12PM INFO Running automatic trash process.
06 Oct 11:41:12PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:41:28PM INFO Running automatic trash process.
06 Oct 11:41:28PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:41:43PM INFO Running automatic trash process.
06 Oct 11:41:43PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:41:58PM INFO Running automatic trash process.
06 Oct 11:41:58PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:42:13PM INFO Running automatic trash process.
06 Oct 11:42:13PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:42:29PM INFO Running automatic trash process.
06 Oct 11:42:29PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:42:44PM INFO Running automatic trash process.
06 Oct 11:42:44PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:42:59PM INFO Running automatic trash process.
06 Oct 11:42:59PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:43:14PM INFO Running automatic trash process.
06 Oct 11:43:14PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:43:29PM INFO Running automatic trash process.
06 Oct 11:43:29PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:43:45PM INFO Running automatic trash process.
06 Oct 11:43:45PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:44:00PM INFO Running automatic trash process.
06 Oct 11:44:00PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:44:15PM INFO Running automatic trash process.
06 Oct 11:44:15PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:44:30PM INFO Running automatic trash process.
06 Oct 11:44:30PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT
06 Oct 11:44:45PM INFO Running automatic trash process.
06 Oct 11:44:45PM ERROR Failed Delete File (Local to Remote) for Item: /Users/richard/odrive/Google Drive/odrive-test/Test2 voor odrive.gdocx - Size: NA - Date: NA - Error: code GD_GDOC_EDIT

Hi @richard,
Thanks for the additional details.

I’ll investigate the behavior you were seeing in both cases see where it might be corrected.