mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
Only set xattr values when not using --dry-run (#3290)
* We can only set xattr values when not performing a --dry-run operation, as if we are doing --download-only --dry-run .. there is no file locally to set attributes on
This commit is contained in:
parent
3394183771
commit
8f82919e5b
1 changed files with 27 additions and 25 deletions
52
src/sync.d
52
src/sync.d
|
|
@ -3918,33 +3918,35 @@ class SyncEngine {
|
|||
displayFunctionProcessingStart(thisFunctionName, logKey);
|
||||
}
|
||||
|
||||
// This function will write the following xattr attributes based on the JSON data received from Microsoft onedrive
|
||||
// - createdBy using the 'displayName' value
|
||||
// - lastModifiedBy using the 'displayName' value
|
||||
|
||||
string createdBy;
|
||||
string lastModifiedBy;
|
||||
|
||||
// Configure 'createdBy' from the JSON data
|
||||
if (hasCreatedByUserDisplayName(onedriveJSONItem)) {
|
||||
createdBy = onedriveJSONItem["createdBy"]["user"]["displayName"].str;
|
||||
} else {
|
||||
// required data not in JSON data
|
||||
createdBy = "Unknown";
|
||||
// We can only set xattr values when not performing a --dry-run operation
|
||||
if (!dryRun) {
|
||||
// This function will write the following xattr attributes based on the JSON data received from Microsoft onedrive
|
||||
// - createdBy using the 'displayName' value
|
||||
// - lastModifiedBy using the 'displayName' value
|
||||
string createdBy;
|
||||
string lastModifiedBy;
|
||||
|
||||
// Configure 'createdBy' from the JSON data
|
||||
if (hasCreatedByUserDisplayName(onedriveJSONItem)) {
|
||||
createdBy = onedriveJSONItem["createdBy"]["user"]["displayName"].str;
|
||||
} else {
|
||||
// required data not in JSON data
|
||||
createdBy = "Unknown";
|
||||
}
|
||||
|
||||
// Configure 'lastModifiedBy' from the JSON data
|
||||
if (hasLastModifiedByUserDisplayName(onedriveJSONItem)) {
|
||||
lastModifiedBy = onedriveJSONItem["lastModifiedBy"]["user"]["displayName"].str;
|
||||
} else {
|
||||
// required data not in JSON data
|
||||
lastModifiedBy = "Unknown";
|
||||
}
|
||||
|
||||
// Set the xattr values
|
||||
setXAttr(filePath, "user.onedrive.createdBy", createdBy);
|
||||
setXAttr(filePath, "user.onedrive.lastModifiedBy", lastModifiedBy);
|
||||
}
|
||||
|
||||
// Configure 'lastModifiedBy' from the JSON data
|
||||
if (hasLastModifiedByUserDisplayName(onedriveJSONItem)) {
|
||||
lastModifiedBy = onedriveJSONItem["lastModifiedBy"]["user"]["displayName"].str;
|
||||
} else {
|
||||
// required data not in JSON data
|
||||
lastModifiedBy = "Unknown";
|
||||
}
|
||||
|
||||
// Set the xattr values
|
||||
setXAttr(filePath, "user.onedrive.createdBy", createdBy);
|
||||
setXAttr(filePath, "user.onedrive.lastModifiedBy", lastModifiedBy);
|
||||
|
||||
// Display function processing time if configured to do so
|
||||
if (appConfig.getValueBool("display_processing_time") && debugLogging) {
|
||||
// Combine module name & running Function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue