utils::decode_params now uses the same config as utils::encode_params
This commit is contained in:
parent
40d4720977
commit
4f64fc3a13
@ -5,13 +5,13 @@ use std::str;
|
|||||||
|
|
||||||
|
|
||||||
pub fn encode_param(raw: &str) -> String {
|
pub fn encode_param(raw: &str) -> String {
|
||||||
URL_SAFE.pad(false);
|
|
||||||
let cfg = base64::Config::new(base64::CharacterSet::UrlSafe, false);
|
let cfg = base64::Config::new(base64::CharacterSet::UrlSafe, false);
|
||||||
encode_config(raw, cfg)
|
encode_config(raw, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_param(enc: &str) -> Result<String, i32> {
|
pub fn decode_param(enc: &str) -> Result<String, i32> {
|
||||||
let bytes = decode_config(enc, URL_SAFE).unwrap();
|
let cfg = base64::Config::new(base64::CharacterSet::UrlSafe, false);
|
||||||
|
let bytes = decode_config(enc, cfg).unwrap();
|
||||||
let res = str::from_utf8(&bytes);
|
let res = str::from_utf8(&bytes);
|
||||||
match res {
|
match res {
|
||||||
Ok(data) => Ok(data.into()),
|
Ok(data) => Ok(data.into()),
|
||||||
|
Loading…
Reference in New Issue
Block a user