aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/http/curl_downloader.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/util/http/curl_downloader.rs')
-rw-r--r--crates/shirabe/src/util/http/curl_downloader.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs
index b49adf7..66ca326 100644
--- a/crates/shirabe/src/util/http/curl_downloader.rs
+++ b/crates/shirabe/src/util/http/curl_downloader.rs
@@ -406,12 +406,11 @@ impl CurlDownloader {
if curl_response.inner.get_status_code() >= 300
&& curl_response.inner.get_header("content-type").as_deref()
== Some("application/json")
+ && let Some(body) = curl_response.inner.get_body()
{
- if let Some(body) = curl_response.inner.get_body() {
- let decoded = shirabe_php_shim::json_decode(body, true)?;
- if let PhpMixed::Array(a) = decoded {
- HttpDownloader::output_warnings(self.io.clone(), &origin, &a)?;
- }
+ let decoded = shirabe_php_shim::json_decode(body, true)?;
+ if let PhpMixed::Array(a) = decoded {
+ HttpDownloader::output_warnings(self.io.clone(), &origin, &a)?;
}
}
@@ -527,7 +526,7 @@ impl CurlDownloader {
// Atomic rename of the `~` temp file to its final name (file mode).
if let Some(filename) = &filename {
- rename(&format!("{}~", filename), filename);
+ rename(format!("{}~", filename), filename);
}
self.resolve_job(id, curl_response.inner);