Sfoglia il codice sorgente

UI/updater: Fix potential fail case when no files to patch

The updater would return HTTP 400 on an empty json array upload for the
patch manifest.
jp9000 8 anni fa
parent
commit
aab843597d
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      UI/win-update/updater/updater.cpp

+ 4 - 1
UI/win-update/updater/updater.cpp

@@ -1086,7 +1086,8 @@ static bool Update(wchar_t *cmdLine)
 	 * Send file hashes                      */
 
 	string newManifest;
-	{
+
+	if (json_array_size(files) > 0) {
 		char *post_body = json_dumps(files, JSON_COMPACT);
 
 		int    responseCode;
@@ -1117,6 +1118,8 @@ static bool Update(wchar_t *cmdLine)
 					responseCode);
 			return false;
 		}
+	} else {
+		newManifest = "[]";
 	}
 
 	/* ------------------------------------- *