From f69c20229b4e4f79d70db626a936c8737e47d8b3 Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Sat, 25 Feb 2017 15:55:20 -0700 Subject: [PATCH] fix: incorrect host when running tests As noted in https://github.com/rust-lang/crates.io/issues/493#issuecomment-282514820, the recorded `http-data` in `src/tests` expects "http://alexcrichton-test.s3.amazonaws.com". But, as the `S3_REGION` env var is loaded as `Some("")`, it matches wrong leading to wrong host "http://alexcrichton-test-.s3.amazonaws.com". This fixes it by handling match when region is empty. --- src/s3/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/s3/lib.rs b/src/s3/lib.rs index f4a43af6035..aa7d82438cf 100644 --- a/src/s3/lib.rs +++ b/src/s3/lib.rs @@ -99,7 +99,8 @@ impl Bucket { pub fn host(&self) -> String { format!("{}.s3{}.amazonaws.com", self.name, match self.region { - Some(ref r) => format!("-{}", r), + Some(ref r) if r != "" => format!("-{}", r), + Some(_) => String::new(), None => String::new(), }) }