diff --git a/helpers/mirror.moon b/helpers/mirror.moon index 4e431bf..a8703c0 100644 --- a/helpers/mirror.moon +++ b/helpers/mirror.moon @@ -65,7 +65,7 @@ update_manifest_on_disk = (server, dest, force=false) -> tmp_fname = "#{fname}.tmp" - http.request { + res, status = http.request { :url sink: ltn12.sink.file io.open tmp_fname, "w" headers: { @@ -73,6 +73,12 @@ update_manifest_on_disk = (server, dest, force=false) -> } } + if (not res) or (type(status) == "number" and status >= 400) + seen_files[fname] = nil + os.execute "rm '#{tmp_fname}'" + print "failed" + continue + os.execute "mv '#{tmp_fname}' #{fname}" print "done"