This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 94ee9ba5859 [fix](http) remove file before downloading (#50754)
94ee9ba5859 is described below
commit 94ee9ba585911ad3f2beff581967d94b6d39a6be
Author: walter <[email protected]>
AuthorDate: Mon May 12 21:41:57 2025 +0800
[fix](http) remove file before downloading (#50754)
---
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 b8d514e5d04..d9ddb0bd084 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: [email protected]
For additional commands, e-mail: [email protected]