mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-02 22:12:33 +02:00
* Update original patch to check for eTag in response to use, if not found set to empty value. * Add cTag response validation for all cTag response use 'in-case' the cTag response is dropped from other responses
This commit is contained in:
parent
8d4a35e34d
commit
c617185c14
48
src/sync.d
48
src/sync.d
|
@ -1535,8 +1535,14 @@ final class SyncEngine
|
||||||
// use the cTag instead of the eTag because OneDrive may update the metadata of files AFTER they have been uploaded via simple upload
|
// use the cTag instead of the eTag because OneDrive may update the metadata of files AFTER they have been uploaded via simple upload
|
||||||
eTag = response["cTag"].str;
|
eTag = response["cTag"].str;
|
||||||
} else {
|
} else {
|
||||||
// cTag missing in response, use the original item.etag
|
// Is there an eTag in the response?
|
||||||
eTag = item.eTag;
|
if ("eTag" in response) {
|
||||||
|
// use the eTag from the response as there was no cTag
|
||||||
|
eTag = response["eTag"].str;
|
||||||
|
} else {
|
||||||
|
// no tag available - set to nothing
|
||||||
|
eTag = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we are --dry-run - simulate the file upload
|
// we are --dry-run - simulate the file upload
|
||||||
|
@ -2021,10 +2027,25 @@ final class SyncEngine
|
||||||
if ((accountType == "personal") || (thisFileSize == 0)){
|
if ((accountType == "personal") || (thisFileSize == 0)){
|
||||||
// Update the item's metadata on OneDrive
|
// Update the item's metadata on OneDrive
|
||||||
string id = response["id"].str;
|
string id = response["id"].str;
|
||||||
string cTag = response["cTag"].str;
|
string cTag;
|
||||||
|
|
||||||
|
// Is there a valid cTag in the response?
|
||||||
|
if ("cTag" in response) {
|
||||||
|
// use the cTag instead of the eTag because OneDrive may update the metadata of files AFTER they have been uploaded
|
||||||
|
cTag = response["cTag"].str;
|
||||||
|
} else {
|
||||||
|
// Is there an eTag in the response?
|
||||||
|
if ("eTag" in response) {
|
||||||
|
// use the eTag from the response as there was no cTag
|
||||||
|
cTag = response["eTag"].str;
|
||||||
|
} else {
|
||||||
|
// no tag available - set to nothing
|
||||||
|
cTag = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (exists(path)) {
|
if (exists(path)) {
|
||||||
SysTime mtime = timeLastModified(path).toUTC();
|
SysTime mtime = timeLastModified(path).toUTC();
|
||||||
// use the cTag instead of the eTag because OneDrive may update the metadata of files AFTER they have been uploaded
|
|
||||||
uploadLastModifiedTime(parent.driveId, id, cTag, mtime);
|
uploadLastModifiedTime(parent.driveId, id, cTag, mtime);
|
||||||
} else {
|
} else {
|
||||||
// will be removed in different event!
|
// will be removed in different event!
|
||||||
|
@ -2092,9 +2113,24 @@ final class SyncEngine
|
||||||
writeln(" done.");
|
writeln(" done.");
|
||||||
}
|
}
|
||||||
string id = response["id"].str;
|
string id = response["id"].str;
|
||||||
string cTag = response["cTag"].str;
|
string cTag;
|
||||||
SysTime mtime = timeLastModified(path).toUTC();
|
|
||||||
|
// Is there a valid cTag in the response?
|
||||||
|
if ("cTag" in response) {
|
||||||
// use the cTag instead of the eTag because Onedrive may update the metadata of files AFTER they have been uploaded
|
// use the cTag instead of the eTag because Onedrive may update the metadata of files AFTER they have been uploaded
|
||||||
|
cTag = response["cTag"].str;
|
||||||
|
} else {
|
||||||
|
// Is there an eTag in the response?
|
||||||
|
if ("eTag" in response) {
|
||||||
|
// use the eTag from the response as there was no cTag
|
||||||
|
cTag = response["eTag"].str;
|
||||||
|
} else {
|
||||||
|
// no tag available - set to nothing
|
||||||
|
cTag = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SysTime mtime = timeLastModified(path).toUTC();
|
||||||
uploadLastModifiedTime(parent.driveId, id, cTag, mtime);
|
uploadLastModifiedTime(parent.driveId, id, cTag, mtime);
|
||||||
} else {
|
} else {
|
||||||
// OneDrive Business account modified file upload handling
|
// OneDrive Business account modified file upload handling
|
||||||
|
|
Loading…
Reference in a new issue