fix: remove dead replace() call in gen_secret_key (credentials.rs) (#2515)

Signed-off-by: cocoon <54054995+kuishou68@users.noreply.github.com>
Signed-off-by: Cocoon-Break <54054995+kuishou68@users.noreply.github.com>
Co-authored-by: loverustfs <hello@rustfs.com>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
Cocoon-Break
2026-04-13 18:42:50 +08:00
committed by GitHub
parent 8efa359a1a
commit 505a566c7c
+3 -2
View File
@@ -204,10 +204,11 @@ pub fn gen_secret_key(length: usize) -> std::io::Result<String> {
let mut key = vec![0u8; URL_SAFE_NO_PAD.estimated_decoded_length(length)];
rng.fill_bytes(&mut key);
// URL_SAFE_NO_PAD uses "-" and "_" instead of "+" and "/", so "/" never
// appears in the output. The .replace("/", "+") was a dead no-op.
let encoded = URL_SAFE_NO_PAD.encode_to_string(&key);
let key_str = encoded.replace("/", "+");
Ok(key_str)
Ok(encoded)
}
/// Get the RPC authentication token from environment variable