diff --git a/src/sync.d b/src/sync.d index ce1e6ca5d..99bb7f260 100644 --- a/src/sync.d +++ b/src/sync.d @@ -1345,13 +1345,11 @@ class SyncEngine { } // Microsoft OneDrive OneNote file objects will report as files but have 'application/msonenote' as their mime type - // Is there a 'file' JSON element? - if ("file" in onedriveJSONItem) { - if (isMicrosoftOneNoteMimeType1(onedriveJSONItem)) { - // Log that this was skipped as this was a Microsoft OneNote item and unsupported - if (verboseLogging) {addLogEntry("Skipping path - The Microsoft OneNote Notebook File '" ~ generatePathFromJSONData(onedriveJSONItem) ~ "' is not supported by this client", ["verbose"]);} - discardDeltaJSONItem = true; - } + // Is there a 'file' JSON element and it has a 'mimeType' element and the mimeType is 'application/msonenote' + if (isItemFile(onedriveJSONItem) && hasMimeType(onedriveJSONItem) && isMicrosoftOneNoteMimeType1(onedriveJSONItem)) { + // Log that this was skipped as this was a Microsoft OneNote item and unsupported + if (verboseLogging) {addLogEntry("Skipping path - The Microsoft OneNote Notebook File '" ~ generatePathFromJSONData(onedriveJSONItem) ~ "' is not supported by this client", ["verbose"]);} + discardDeltaJSONItem = true; } // If we are not self-generating a /delta response, check this initial /delta JSON bundle item against the basic checks diff --git a/src/util.d b/src/util.d index 17b928d13..47f8a3b3c 100644 --- a/src/util.d +++ b/src/util.d @@ -972,6 +972,10 @@ bool hasId(JSONValue item) { return ("id" in item) != null; } +bool hasMimeType(const ref JSONValue item) { + return ("mimeType" in item["file"]) != null; +} + bool hasQuota(JSONValue item) { return ("quota" in item) != null; }