stylus icon indicating copy to clipboard operation
stylus copied to clipboard

[Bug] OneDrive for Business cloud sync: failed to fetch [404]

Open abulgatz opened this issue 3 years ago • 3 comments

Bug Report

Bug Description

Error when trying to sync Stylus to OneDrive for Business:

failed to fetch [404]: {
  "error": {
    "code": "itemNotFound",
    "message": "Item not found",
    "innerError": {
      "date": "2021-10-29T03:17:18",
      "request-id": "a2a6152d-044e-4ab6-b272-50257cc1aaac",
      "client-request-id": "a2a6152d-044e-4ab6-b272-50257cc1aaac"
    }
  }
}

System Information

  • OS: macOS 11.6 and macOS 12.0.1
  • Browser: Firefox 93.0 M1 and Intel
  • Stylus Version: 1.5.21

Additional Context

I have tried Disconnecting/Connecting and clicking the "Sync" button to no difference.

abulgatz avatar Oct 29 '21 03:10 abulgatz

So Stylus requests Files.ReadWrite.AppFolder permissions.

It looks like OneDrive for business doesn't support this permission.

From: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/concepts/special-folders-appfolder?view=odsp-graph-online

Note, Business OneDrive accounts do not currently support the Files.ReadWrite.AppFolder permission

Although when looking in my own permissions, I see:

Permission description: (Preview) Allows the app to read, create, update and delete files in the application's folder.

So I am not sure if the permission actually exists or not.

abulgatz avatar Oct 29 '21 04:10 abulgatz

That link mentions a second permission, Files.ReadWrite, which is not forbidden in OneDrive Business. @eight04, could you check if it's usable for Stylus?

tophf avatar Oct 29 '21 06:10 tophf

I think it is usable:

  1. However, it is a broader permission compared to Files.ReadWrite.AppFolder (https://docs.microsoft.com/en-us/onedrive/developer/rest-api/concepts/permissions_reference)
  2. We have to make the root folder customizable.
  3. Update db-to-cloud to make it accept a custom path. Currently it always operate on special/approot: https://github.com/eight04/db-to-cloud/blob/cf3b4f690f0e29d666c1a4f8274e8899dc28e214/lib/drive/onedrive.js#L19

eight04 avatar Oct 29 '21 08:10 eight04