mirror of
https://codeberg.org/demostf/backup.git
synced 2026-06-03 18:04:08 +02:00
fix enscaped hex
This commit is contained in:
parent
4bb4e38432
commit
114c4175c9
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use crate::Error;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Deserializer};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
|
|
@ -35,13 +36,13 @@ where
|
|||
use hex::FromHex;
|
||||
use serde::de::Error;
|
||||
|
||||
let string = <&str>::deserialize(deserializer)?;
|
||||
let string = <Cow<str>>::deserialize(deserializer)?;
|
||||
|
||||
if string.len() == 0 {
|
||||
return Ok([0; 16]);
|
||||
}
|
||||
|
||||
<[u8; 16]>::from_hex(string).map_err(|err| Error::custom(err.to_string()))
|
||||
<[u8; 16]>::from_hex(string.as_ref()).map_err(|err| Error::custom(err.to_string()))
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue