This is an automated email from the ASF dual-hosted git repository.

w41ter pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 77fbe6397ab [fix](http) Remove file if downloading faile is failed 
#41778 (#41827)
77fbe6397ab is described below

commit 77fbe6397ab7f33feb1cd5d76b4e1ede7cd1878a
Author: walter <[email protected]>
AuthorDate: Tue Oct 15 15:30:29 2024 +0800

    [fix](http) Remove file if downloading faile is failed #41778 (#41827)
    
    cherry pick from #41778
---
 be/src/http/http_client.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/be/src/http/http_client.cpp b/be/src/http/http_client.cpp
index e94614788f5..bf1cd751ae3 100644
--- a/be/src/http/http_client.cpp
+++ b/be/src/http/http_client.cpp
@@ -253,7 +253,13 @@ Status HttpClient::download(const std::string& local_path) 
{
         }
         return true;
     };
-    RETURN_IF_ERROR(execute(callback));
+
+    if (auto s = execute(callback); !s.ok()) {
+        status = s;
+    }
+    if (!status.ok()) {
+        remove(local_path.c_str());
+    }
     return status;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to