From 58898fb21cc8f4004b5105a301d2c2fe2db5eb59 Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Tue, 17 Sep 2024 22:10:26 +0530 Subject: [PATCH] fix path construction in BaseUrl::BuildUrl() Fixes #173 Signed-off-by: Bala.FA --- src/request.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/request.cc b/src/request.cc index b1621ac..9b6130c 100644 --- a/src/request.cc +++ b/src/request.cc @@ -273,7 +273,7 @@ error::Error BaseUrl::BuildUrl(http::Url& url, http::Method method, } std::string host = url.host; - std::string path; + std::string path = "/"; if (enforce_path_style || !this->virtual_style) { path = "/" + bucket_name; @@ -282,7 +282,7 @@ error::Error BaseUrl::BuildUrl(http::Url& url, http::Method method, } if (!object_name.empty()) { - if (object_name.front() != '/') path += '/'; + if (!utils::EndsWith(path, "/")) path += '/'; path += utils::EncodePath(object_name); }