utils::decode_params now uses the same config as utils::encode_params

This commit is contained in:
shockrah 2020-05-20 01:21:01 -07:00
parent 40d4720977
commit 4f64fc3a13

View File

@ -5,13 +5,13 @@ use std::str;
pub fn encode_param(raw: &str) -> String {
URL_SAFE.pad(false);
let cfg = base64::Config::new(base64::CharacterSet::UrlSafe, false);
encode_config(raw, cfg)
}
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);
match res {
Ok(data) => Ok(data.into()),