fix(githubsync): use plain HTTPClient for downloads matching working implementation

This commit is contained in:
Justin Oros
2026-04-22 19:39:53 -07:00
parent 40270bb6d9
commit e4f411dde5
+7 -5
View File
@@ -4,7 +4,6 @@
#include <HalStorage.h>
#include <Logging.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
#include <string>
@@ -75,11 +74,9 @@ void saveLocalSha(const std::string& filename, const std::string& sha) {
bool downloadFile(const std::string& downloadUrl, const std::string& pat,
const std::string& destPath, const std::string& name,
const std::string& sha) {
WiFiClientSecure client;
client.setInsecure();
HTTPClient http;
http.begin(client, downloadUrl.c_str());
LOG_INF("GHS", "Download URL: %s", downloadUrl.c_str());
http.begin(downloadUrl.c_str());
http.setTimeout(30000);
http.addHeader("Authorization", ("token " + pat).c_str());
http.addHeader("User-Agent", "CrossPoint-GitHubSync/1.0");
@@ -181,6 +178,11 @@ bool syncContents(const RepoInfo& info, const std::string& pat) {
continue;
}
if (Storage.exists(destPath.c_str())) {
LOG_DBG("GHS", "File exists, skipping: %s", name);
continue;
}
LOG_INF("GHS", "Downloading: %s", name);
if (!downloadFile(std::string(downloadUrl), pat, destPath, n, std::string(sha)))
return false;