[Scummvm-git-logs] scummvm master -> 9dd3a6766cdfc9fd9a238f3725808908e5a363e2

bluegr noreply at scummvm.org
Fri Oct 4 13:24:02 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9dd3a6766c CLOUD: fix #15337


Commit: 9dd3a6766cdfc9fd9a238f3725808908e5a363e2
    https://github.com/scummvm/scummvm/commit/9dd3a6766cdfc9fd9a238f3725808908e5a363e2
Author: Alexander Tkachov (alexander at tkachov.ru)
Date: 2024-10-04T16:23:59+03:00

Commit Message:
CLOUD: fix #15337

Fixes OneDrive sync by handling list of unexisting "saves" subdirectory.

Previously, code that worked with JSON didn't trigger, because string was intentionally malformed. If it wasn't, OneDriveTokenRefresher::finishError() would've treated it as JSON parse failure, tried to fix it, and call finishJson() instead of finishError().

Changed paths:
    backends/cloud/onedrive/onedrivetokenrefresher.cpp
    backends/cloud/onedrive/onedrivetokenrefresher.h


diff --git a/backends/cloud/onedrive/onedrivetokenrefresher.cpp b/backends/cloud/onedrive/onedrivetokenrefresher.cpp
index f26e00e5f7d..cc6da8ff3f1 100644
--- a/backends/cloud/onedrive/onedrivetokenrefresher.cpp
+++ b/backends/cloud/onedrive/onedrivetokenrefresher.cpp
@@ -97,8 +97,8 @@ void OneDriveTokenRefresher::finishJson(const Common::JSONValue *json) {
 				irrecoverable = false;
 
 			if (irrecoverable) {
-				Common::String errorContents = "<irrecoverable> " + json->stringify(true);
-				finishError(Networking::ErrorResponse(this, false, true, errorContents, httpResponseCode));
+				Common::String errorContents = json->stringify(true);
+				finishErrorIrrecoverable(Networking::ErrorResponse(this, false, true, errorContents, httpResponseCode));
 				delete json;
 				return;
 			}
@@ -134,7 +134,12 @@ void OneDriveTokenRefresher::finishError(const Networking::ErrorResponse &error,
 		}
 	}
 
-	Request::finishError(error); //call closest base class's method
+	Request::finishError(error, state); //call closest base class's method
+}
+
+void OneDriveTokenRefresher::finishErrorIrrecoverable(const Networking::ErrorResponse &error, Networking::RequestState state) {
+	// don't try to fix JSON as this is irrecoverable version
+	Request::finishError(error, state); // call closest base class's method
 }
 
 void OneDriveTokenRefresher::setHeaders(const Common::Array<Common::String> &headers) {
diff --git a/backends/cloud/onedrive/onedrivetokenrefresher.h b/backends/cloud/onedrive/onedrivetokenrefresher.h
index 4fd452ea156..781b283bff9 100644
--- a/backends/cloud/onedrive/onedrivetokenrefresher.h
+++ b/backends/cloud/onedrive/onedrivetokenrefresher.h
@@ -38,6 +38,8 @@ class OneDriveTokenRefresher: public Networking::CurlJsonRequest {
 
 	void finishJson(const Common::JSONValue *json) override;
 	void finishError(const Networking::ErrorResponse &error, Networking::RequestState state = Networking::FINISHED) override;
+	void finishErrorIrrecoverable(const Networking::ErrorResponse &error, Networking::RequestState state = Networking::FINISHED);
+
 public:
 	OneDriveTokenRefresher(OneDriveStorage *parent, Networking::JsonCallback callback, Networking::ErrorCallback ecb, const char *url);
 	~OneDriveTokenRefresher() override;




More information about the Scummvm-git-logs mailing list