Skip to content

Commit 3b60eb2

Browse files
committed
fix(config)!: strip /dist suffix from RUSTUP_DIST_ROOT only once
1 parent 64ad614 commit 3b60eb2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/config.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1004,9 +1004,12 @@ pub(crate) fn dist_root_server(process: &Process) -> Result<String> {
10041004
s
10051005
}
10061006
// For backwards compatibility
1007-
else if let Some(root) = non_empty_env_var("RUSTUP_DIST_ROOT", process)? {
1007+
else if let Some(mut root) = non_empty_env_var("RUSTUP_DIST_ROOT", process)? {
10081008
trace!("`RUSTUP_DIST_ROOT` has been set to `{root}`");
1009-
root.trim_end_matches("/dist").to_owned()
1009+
if let Some(stripped) = root.strip_suffix("/dist") {
1010+
root.truncate(stripped.len());
1011+
}
1012+
root
10101013
} else {
10111014
dist::DEFAULT_DIST_SERVER.to_owned()
10121015
},

0 commit comments

Comments
 (0)