mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-09 01:06:40 +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
|
||||
eTag = response["cTag"].str;
|
||||
} else {
|
||||
// cTag missing in response, use the original item.etag
|
||||
eTag = item.eTag;
|
||||
// Is there an eTag in the response?
|
||||
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 {
|
||||
// we are --dry-run - simulate the file upload
|
||||
|
@ -2021,10 +2027,25 @@ final class SyncEngine
|
|||
if ((accountType == "personal") || (thisFileSize == 0)){
|
||||
// Update the item's metadata on OneDrive
|
||||
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)) {
|
||||
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);
|
||||
} else {
|
||||
// will be removed in different event!
|
||||
|
@ -2092,9 +2113,24 @@ final class SyncEngine
|
|||
writeln(" done.");
|
||||
}
|
||||
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 = "";
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
} else {
|
||||
// OneDrive Business account modified file upload handling
|
||||
|
|
Loading…
Reference in a new issue