This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 068531129d1 branch-2.1: [fix](http) remove file before downloading
#50754 (#50827)
068531129d1 is described below
commit 068531129d1f6bace3f820fb15a3a4c544d792d1
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue May 13 15:44:34 2025 +0800
branch-2.1: [fix](http) remove file before downloading #50754 (#50827)
Cherry-picked from #50754
Co-authored-by: walter <[email protected]>
---
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 8ead9387a4f..637765b62f3 100644
--- a/be/src/http/http_client.cpp
+++ b/be/src/http/http_client.cpp
@@ -454,6 +454,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: [email protected]
For additional commands, e-mail: [email protected]