mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-03-15 04:30:26 +03:00
Fix sends expecting size to be a string on mobile
This commit is contained in:
parent
b4c95189b8
commit
0d6a8b8a32
1 changed files with 12 additions and 2 deletions
|
@ -124,7 +124,12 @@ impl Send {
|
|||
use data_encoding::BASE64URL_NOPAD;
|
||||
use uuid::Uuid;
|
||||
|
||||
let data = serde_json::from_str::<LowerCase<Value>>(&self.data).map(|d| d.data).unwrap_or_default();
|
||||
let mut data = serde_json::from_str::<LowerCase<Value>>(&self.data).map(|d| d.data).unwrap_or_default();
|
||||
|
||||
// Mobile clients expect size to be a string instead of a number
|
||||
if let Some(size) = data.get("size").and_then(|v| v.as_i64()) {
|
||||
data["size"] = Value::String(size.to_string());
|
||||
}
|
||||
|
||||
json!({
|
||||
"id": self.uuid,
|
||||
|
@ -153,7 +158,12 @@ impl Send {
|
|||
pub async fn to_json_access(&self, conn: &mut DbConn) -> Value {
|
||||
use crate::util::format_date;
|
||||
|
||||
let data = serde_json::from_str::<LowerCase<Value>>(&self.data).map(|d| d.data).unwrap_or_default();
|
||||
let mut data = serde_json::from_str::<LowerCase<Value>>(&self.data).map(|d| d.data).unwrap_or_default();
|
||||
|
||||
// Mobile clients expect size to be a string instead of a number
|
||||
if let Some(size) = data.get("size").and_then(|v| v.as_i64()) {
|
||||
data["size"] = Value::String(size.to_string());
|
||||
}
|
||||
|
||||
json!({
|
||||
"id": self.uuid,
|
||||
|
|
Loading…
Add table
Reference in a new issue