Update dependencies and remove unwraps from Cipher::to_json

This commit is contained in:
Daniel García 2019-06-14 22:51:50 +02:00
parent fff72889f6
commit 76f38621de
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A
4 changed files with 198 additions and 170 deletions

337
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ rocket = { version = "0.5.0-dev", features = ["tls"], default-features = false }
rocket_contrib = "0.5.0-dev"
# HTTP client
reqwest = "0.9.17"
reqwest = "0.9.18"
# multipart/form-data support
multipart = { version = "0.16.1", features = ["server"], default-features = false }
@ -86,15 +86,15 @@ dotenv = { version = "0.14.1", default-features = false }
lazy_static = "1.3.0"
# More derives
derive_more = "0.14.1"
derive_more = "0.15.0"
# Numerical libraries
num-traits = "0.2.8"
num-derive = "0.2.5"
# Email libraries
lettre = "0.9.1"
lettre_email = "0.9.1"
lettre = "0.9.2"
lettre_email = "0.9.2"
native-tls = "0.2.3"
quoted_printable = "0.4.1"
@ -103,7 +103,7 @@ handlebars = "1.1.0"
# For favicon extraction from main website
soup = "0.4.1"
regex = "1.1.6"
regex = "1.1.7"
[patch.crates-io]
# Add support for Timestamp type
@ -112,7 +112,3 @@ rmp = { git = 'https://github.com/dani-garcia/msgpack-rust' }
# Use newest ring
rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = 'dbcb0a75b9556763ac3ab708f40c8f8ed75f1a1e' }
rocket_contrib = { git = 'https://github.com/SergioBenitez/Rocket', rev = 'dbcb0a75b9556763ac3ab708f40c8f8ed75f1a1e' }
# Fix lettre on newer nightlies
lettre = { version = "0.9", git = "https://github.com/lettre/lettre", rev= '0ead3cde09a02918e3976aa442329fe247f05c55' }
lettre_email = { version = "0.9", git = "https://github.com/lettre/lettre", rev= '0ead3cde09a02918e3976aa442329fe247f05c55' }

View File

@ -1 +1 @@
nightly-2019-06-01
nightly-2019-06-14

View File

@ -77,19 +77,10 @@ impl Cipher {
let attachments = Attachment::find_by_cipher(&self.uuid, conn);
let attachments_json: Vec<Value> = attachments.iter().map(|c| c.to_json(host)).collect();
let fields_json: Value = if let Some(ref fields) = self.fields {
serde_json::from_str(fields).unwrap()
} else {
Value::Null
};
let fields_json = self.fields.as_ref().and_then(|s| serde_json::from_str(s).ok()).unwrap_or(Value::Null);
let password_history_json = self.password_history.as_ref().and_then(|s| serde_json::from_str(s).ok()).unwrap_or(Value::Null);
let password_history_json: Value = if let Some(ref password_history) = self.password_history {
serde_json::from_str(password_history).unwrap()
} else {
Value::Null
};
let mut data_json: Value = serde_json::from_str(&self.data).unwrap();
let mut data_json: Value = serde_json::from_str(&self.data).unwrap_or(Value::Null);
// TODO: ******* Backwards compat start **********
// To remove backwards compatibility, just remove this entire section