diff --git a/plugins/githubsync/GitHubSyncPlugin.cpp b/plugins/githubsync/GitHubSyncPlugin.cpp index ac6050b..0323f1e 100644 --- a/plugins/githubsync/GitHubSyncPlugin.cpp +++ b/plugins/githubsync/GitHubSyncPlugin.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -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;