Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Existing sync folders give "Root directoy is not empty" after API credentials change #429

Description

@rohfle

I ran into this issue during #426 and pull request #428

WHAT
After the ClientID / ClientSecret is changed, gdrive sync upload results in the following error
Root directoy is not empty, the initial sync requires an empty directory

WHY DOES THIS HAPPEN

  • gdrive uses app-specific appProperties to store metadata in sync folders, which is used during the syncing process
  • Changing API credentials means that Google APIs see gdrive as a different "app", so appProperties are no longer present

IMPLEMENTATION SPECIFICS
Usage of sync for reference - gdrive sync upload /path/to/localdir **FOLDER_ID**


  1. **FOLDER_ID**, the sync root folder, has the following appProperties set:
{
    "sync": "true",
    "syncRoot": "true"
}

// Update directory with syncRoot property


  1. Every file and subfolder in /path/to/localdir has the following appProperties set when they are uploaded:
{
    "sync": "true",
    "syncRootId": **FOLDER_ID**,
}

dstFile := &drive.File{

and
dstFile := &drive.File{


  1. When gdrive syncs again, it uses this query "appProperties has {key='syncRootId' and value='%s'}" to get a complete listing of the synced remote files

func (self *Drive) prepareRemoteFiles(rootDir *drive.File, sortOrder string) ([]*RemoteFile, error) {

SUGGESTIONS FOR FUTURE
properties could be used instead of appProperties with namespaced keys (ie starting with gdrive-*) so that when the client credentials change, the sync properties are still visible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions