Handling Relative Paths in Uppy with OneDrive Connector (Companion)

When using Uppy with local file uploads, the webkitRelativePath property is available, allowing us to maintain the folder structure during uploads. This feature is particularly useful for preserving the organization of files, especially when uploading a large number of files or nested directories.

However, when using the OneDrive connector (via Uppy Companion), this relative path information isn’t natively available. As a result, files uploaded from OneDrive lose their folder context, making it difficult to maintain the original structure on the server.

Example:

  • **Local Uploads with Uppy:**When uploading from a local file system, the File object in Uppy contains a webkitRelativePath property:
File {
  name: 'example.pdf',
  lastModified: 1625127509313,
  lastModifiedDate: Thu Jul 01 2021 10:05:09 GMT+0100,
  webkitRelativePath: 'Documents/Project/Reports/example.pdf',
  size: 102400,
  type: 'application/pdf'
}

This allows us to easily recreate the folder structure on the server.

  • **OneDrive Connector:**When using the OneDrive connector, the File object does not include webkitRelativePath. Instead, the metadata looks something like this:
File data object: {
  name: 'example.pdf',
  mimeType: 'application/pdf',
  id: '12345',
  modifiedDate: '2023-08-31T10:01:45Z',
  size: 3642455
}

As you can see, there is no information about the file’s original path within OneDrive.

Questions for the Community:

  • Has anyone encountered this issue with Uppy and OneDrive before?
  • Are there any existing solutions or workarounds that you’ve successfully implemented?

Looking forward to hearing your thoughts and suggestions!