Merge pull request #8554 from nextcloud/correctEtagCheck

Correct etag check/store when it has changed
This commit is contained in:
Andy Scherzinger 2021-06-11 10:12:57 +02:00 committed by GitHub
commit 9b1d03181c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,6 +243,8 @@ public class RefreshFolderOperation extends RemoteOperation {
if (result.isSuccess()) { if (result.isSuccess()) {
// request for the synchronization of KEPT-IN-SYNC file contents // request for the synchronization of KEPT-IN-SYNC file contents
startContentSynchronizations(mFilesToSyncContents); startContentSynchronizations(mFilesToSyncContents);
} else {
mLocalFolder.setEtag("");
} }
mLocalFolder.setLastSyncDateForData(System.currentTimeMillis()); mLocalFolder.setLastSyncDateForData(System.currentTimeMillis());
@ -370,7 +372,7 @@ public class RefreshFolderOperation extends RemoteOperation {
// check if remote and local folder are different // check if remote and local folder are different
String remoteFolderETag = remoteFolder.getEtag(); String remoteFolderETag = remoteFolder.getEtag();
if (remoteFolderETag != null) { if (remoteFolderETag != null) {
mRemoteFolderChanged = !(remoteFolderETag.equalsIgnoreCase(mLocalFolder.getEtagOnServer())); mRemoteFolderChanged = !(remoteFolderETag.equalsIgnoreCase(mLocalFolder.getEtag()));
} else { } else {
Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + ": No ETag received from server"); Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + ": No ETag received from server");
} }
@ -464,6 +466,9 @@ public class RefreshFolderOperation extends RemoteOperation {
// update richWorkspace // update richWorkspace
mLocalFolder.setRichWorkspace(remoteFolder.getRichWorkspace()); mLocalFolder.setRichWorkspace(remoteFolder.getRichWorkspace());
// update eTag
mLocalFolder.setEtag(remoteFolder.getEtag());
DecryptedFolderMetadata metadata = getDecryptedFolderMetadata(encryptedAncestor, DecryptedFolderMetadata metadata = getDecryptedFolderMetadata(encryptedAncestor,
mLocalFolder, mLocalFolder,
getClient(), getClient(),