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

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


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

commit 2e4162344befe85ba4d468cc21c3b0ab3bc65de4
Author: walter <[email protected]>
AuthorDate: Tue Oct 15 15:30:22 2024 +0800

    [fix](http) Remove file if downloading faile is failed #41778 (#41829)
    
    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 218802878bd..3cad98e11b7 100644
--- a/be/src/http/http_client.cpp
+++ b/be/src/http/http_client.cpp
@@ -250,7 +250,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