simplify and add tests for upload (and replace) path

This commit is contained in:
Shish
2020-10-28 20:51:34 +00:00
parent 7cb18568e3
commit 3f5930b4cb
9 changed files with 262 additions and 219 deletions

View File

@@ -66,7 +66,7 @@ class Update extends Extension
$filename = "./data/update_{$commitSHA}.zip";
log_info("update", "Attempting to download Shimmie commit: ".$commitSHA);
if ($headers = transload($url, $filename)) {
if ($headers = fetch_url($url, $filename)) {
if (($headers['Content-Type'] !== MimeType::ZIP) || ((int) $headers['Content-Length'] !== filesize($filename))) {
unlink("./data/update_{$commitSHA}.zip");
log_warning("update", "Download failed: not zip / not same size as remote file.");