Browse Source

Fix passwordRevisionDate format

The `passwordRevisionDate` format was not converted to a valid format understand by the mobile clients.
Fixed this by checking if it's not `null` and then convert the timestamp to a valid format.

Signed-off-by: BlackDex <black.dex@gmail.com>
pull/5477/head
BlackDex 3 months ago
parent
commit
fc00b7ff09
No known key found for this signature in database GPG Key ID: 58C80A2AA6C765E1
  1. 9
      src/db/models/cipher.rs

9
src/db/models/cipher.rs

@ -142,7 +142,7 @@ impl Cipher {
sync_type: CipherSyncType, sync_type: CipherSyncType,
conn: &mut DbConn, conn: &mut DbConn,
) -> Value { ) -> Value {
use crate::util::format_date; use crate::util::{format_date, validate_and_format_date};
let mut attachments_json: Value = Value::Null; let mut attachments_json: Value = Value::Null;
if let Some(cipher_sync_data) = cipher_sync_data { if let Some(cipher_sync_data) = cipher_sync_data {
@ -220,7 +220,7 @@ impl Cipher {
}) })
.map(|mut d| match d.get("lastUsedDate").and_then(|l| l.as_str()) { .map(|mut d| match d.get("lastUsedDate").and_then(|l| l.as_str()) {
Some(l) => { Some(l) => {
d["lastUsedDate"] = json!(crate::util::validate_and_format_date(l)); d["lastUsedDate"] = json!(validate_and_format_date(l));
d d
} }
_ => { _ => {
@ -261,6 +261,11 @@ impl Cipher {
type_data_json["uri"] = uris[0]["uri"].clone(); type_data_json["uri"] = uris[0]["uri"].clone();
} }
} }
// Check if `passwordRevisionDate` is a valid date, else convert it
if let Some(pw_revision) = type_data_json["passwordRevisionDate"].as_str() {
type_data_json["passwordRevisionDate"] = json!(validate_and_format_date(pw_revision));
}
} }
// Fix secure note issues when data is invalid // Fix secure note issues when data is invalid

Loading…
Cancel
Save