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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 6f570edd539 branch-3.0: [fix](http) remove file before downloading 
#50754 (#50824)
6f570edd539 is described below

commit 6f570edd5390e8816f4232a1c362c078f101f59c
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue May 13 09:38:21 2025 +0800

    branch-3.0: [fix](http) remove file before downloading #50754 (#50824)
    
    Cherry-picked from #50754
    
    Co-authored-by: walter <maoch...@selectdb.com>
---
 be/src/http/http_client.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/be/src/http/http_client.cpp b/be/src/http/http_client.cpp
index 93f46712341..73786d31469 100644
--- a/be/src/http/http_client.cpp
+++ b/be/src/http/http_client.cpp
@@ -456,6 +456,13 @@ Status HttpClient::download(const std::string& local_path) 
{
     set_method(GET);
     set_speed_limit();
 
+    // remove the file if it exists, to avoid change the linked files 
unexpectedly
+    bool exist = false;
+    RETURN_IF_ERROR(io::global_local_filesystem()->exists(local_path, &exist));
+    if (exist) {
+        remove(local_path.c_str());
+    }
+
     auto fp_closer = [](FILE* fp) { fclose(fp); };
     std::unique_ptr<FILE, decltype(fp_closer)> fp(fopen(local_path.c_str(), 
"w"), fp_closer);
     if (fp == nullptr) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to