This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 05b7de294 chore(services/swift): Use QueryPairsWriter for url write
(#5983)
05b7de294 is described below
commit 05b7de294f186f4fcede819e7b7a09d5186f369d
Author: Asuka Minato <[email protected]>
AuthorDate: Wed Apr 9 13:49:23 2025 +0900
chore(services/swift): Use QueryPairsWriter for url write (#5983)
swift QueryPairsWriter
---
core/src/services/swift/core.rs | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/core/src/services/swift/core.rs b/core/src/services/swift/core.rs
index 7f0dba313..39b322ae5 100644
--- a/core/src/services/swift/core.rs
+++ b/core/src/services/swift/core.rs
@@ -76,22 +76,19 @@ impl SwiftCore {
// The delimiter is used to disable recursive listing.
// Swift returns a 200 status code when there is no such pseudo
directory in prefix.
- let mut url = format!(
- "{}/{}/?prefix={}&delimiter={}&format=json",
- &self.endpoint,
- &self.container,
- percent_encode_path(&p),
- delimiter
- );
+ let mut url = QueryPairsWriter::new(&format!("{}/{}/", &self.endpoint,
&self.container,))
+ .push("prefix", &percent_encode_path(&p))
+ .push("delimiter", delimiter)
+ .push("format", "json");
if let Some(limit) = limit {
- url += &format!("&limit={}", limit);
+ url = url.push("limit", &limit.to_string());
}
if !marker.is_empty() {
- url += &format!("&marker={}", marker);
+ url = url.push("marker", marker);
}
- let mut req = Request::get(&url);
+ let mut req = Request::get(url.finish());
req = req.header("X-Auth-Token", &self.token);