Skip to content

Commit

Permalink
chore: add trim_end to token as triage weird bug
Browse files Browse the repository at this point in the history
  • Loading branch information
morristai committed Nov 6, 2023
1 parent 7804dbf commit 31a5b04
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/src/services/swift/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ impl SwiftCore {

let mut req = Request::delete(&url);

req = req.header("X-Auth-Token", &self.token);
eprintln!("X-Auth-Token: {}", &self.token);
req = req.header("X-Auth-Token", &self.token.trim_end());

let body = AsyncBody::Empty;

Expand Down Expand Up @@ -87,7 +86,7 @@ impl SwiftCore {

let mut req = Request::get(&url);

req = req.header("X-Auth-Token", &self.token);
req = req.header("X-Auth-Token", &self.token.trim_end());

let req = req
.body(AsyncBody::Empty)
Expand All @@ -113,7 +112,7 @@ impl SwiftCore {

let mut req = Request::put(&url);

req = req.header("X-Auth-Token", &self.token);
req = req.header("X-Auth-Token", &self.token.trim_end());

if p.ends_with('/') {
req = req.header("Content-Length", "0");
Expand Down Expand Up @@ -141,7 +140,7 @@ impl SwiftCore {

let mut req = Request::get(&url);

req = req.header("X-Auth-Token", &self.token);
req = req.header("X-Auth-Token", &self.token.trim_end());

if !range.is_full() {
req = req.header("Range", &range.to_header());
Expand Down Expand Up @@ -183,7 +182,7 @@ impl SwiftCore {
// Reference: https://docs.openstack.org/api-ref/object-store/#copy-object
let mut req = Request::put(&url);

req = req.header("X-Auth-Token", &self.token);
req = req.header("X-Auth-Token", &self.token.trim_end());
req = req.header("X-Copy-From", percent_encode_path(&src_p));

// if use PUT method, we need to set the content-length to 0.
Expand All @@ -209,7 +208,7 @@ impl SwiftCore {

let mut req = Request::head(&url);

req = req.header("X-Auth-Token", &self.token);
req = req.header("X-Auth-Token", &self.token.trim_end());

let req = req
.body(AsyncBody::Empty)
Expand Down

0 comments on commit 31a5b04

Please sign in to comment.