fixes to K2V client #571
2 changed files with 8 additions and 4 deletions
|
@ -157,7 +157,9 @@ impl Value {
|
||||||
if let Some(ref text) = self.text {
|
if let Some(ref text) = self.text {
|
||||||
Ok(text.as_bytes().to_vec())
|
Ok(text.as_bytes().to_vec())
|
||||||
} else if let Some(ref b64) = self.b64 {
|
} else if let Some(ref b64) = self.b64 {
|
||||||
BASE64_STANDARD.decode(b64).map_err(|_| Error::Message("invalid base64 input".into()))
|
BASE64_STANDARD
|
||||||
|
.decode(b64)
|
||||||
|
.map_err(|_| Error::Message("invalid base64 input".into()))
|
||||||
} else if let Some(ref path) = self.file {
|
} else if let Some(ref path) = self.file {
|
||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
if path == "-" {
|
if path == "-" {
|
||||||
|
|
|
@ -483,9 +483,11 @@ impl<'de> Deserialize<'de> for K2vValue {
|
||||||
{
|
{
|
||||||
let val: Option<&str> = Option::deserialize(d)?;
|
let val: Option<&str> = Option::deserialize(d)?;
|
||||||
Ok(match val {
|
Ok(match val {
|
||||||
Some(s) => {
|
Some(s) => K2vValue::Value(
|
||||||
K2vValue::Value(BASE64_STANDARD.decode(s).map_err(|_| DeError::custom("invalid base64"))?)
|
BASE64_STANDARD
|
||||||
}
|
.decode(s)
|
||||||
|
.map_err(|_| DeError::custom("invalid base64"))?,
|
||||||
|
),
|
||||||
None => K2vValue::Tombstone,
|
None => K2vValue::Tombstone,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue