Fix where --resync is enforced for non-sync operations (#2111)

* Fix that the --resync option is wrongly enforced when the OneDrive client is started with --list-shared-folders option or other non-sync options. This only happens when configuration changes are detected.
This commit is contained in:
abraunegg 2022-08-26 09:11:10 +10:00 committed by GitHub
parent 33423ee441
commit 3b7a06cdcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -457,9 +457,18 @@ int main(string[] args)
// Has anything triggered a --resync requirement?
if (configOptionsDifferent || syncListDifferent || syncDirDifferent || skipFileDifferent || skipDirDifferent || businessSharedFoldersDifferent) {
// --resync needed, is the user just testing configuration changes?
if (!cfg.getValueBool("display_config")){
// not testing configuration changes
// --resync needed, is the user performing any operation where a --resync is not required?
// flag to ignore --resync requirement
bool ignoreResyncRequirement = false;
// These flags do not need --resync as no sync operation is needed: --display-config, --list-shared-folders, --get-O365-drive-id, --get-file-link
if (cfg.getValueBool("display_config")) ignoreResyncRequirement = true;
if (cfg.getValueBool("list_business_shared_folders")) ignoreResyncRequirement = true;
if ((!cfg.getValueString("get_o365_drive_id").empty)) ignoreResyncRequirement = true;
if ((!cfg.getValueString("get_file_link").empty)) ignoreResyncRequirement = true;
// Do we need to ignore a --resync requirement?
if (!ignoreResyncRequirement) {
// We are not ignoring --requirement
if (!cfg.getValueBool("resync")) {
// --resync not issued, fail fast
log.error("An application configuration change has been detected where a --resync is required");