From 56b4f46d7d9c818a392d3ab62322302ed8b0c723 Mon Sep 17 00:00:00 2001 From: Jeremy Lin Date: Mon, 16 Aug 2021 22:23:33 -0700 Subject: [PATCH] Fix limitation on sharing ciphers with attachments This check is several years old, so maybe there was a valid reason for having it before, but it's not correct anymore. --- src/api/core/ciphers.rs | 6 ------ src/db/models/attachment.rs | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index f9133bec..8fc1137a 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -687,12 +687,6 @@ fn put_cipher_share_selected( }; } - let attachments = Attachment::find_by_ciphers(cipher_ids, &conn); - - if !attachments.is_empty() { - err!("Ciphers should not have any attachments.") - } - while let Some(cipher) = data.Ciphers.pop() { let mut shared_cipher_data = ShareCipherData { Cipher: cipher, diff --git a/src/db/models/attachment.rs b/src/db/models/attachment.rs index 04ad8990..bb0f9395 100644 --- a/src/db/models/attachment.rs +++ b/src/db/models/attachment.rs @@ -143,16 +143,6 @@ impl Attachment { }} } - pub fn find_by_ciphers(cipher_uuids: Vec, conn: &DbConn) -> Vec { - db_run! { conn: { - attachments::table - .filter(attachments::cipher_uuid.eq_any(cipher_uuids)) - .load::(conn) - .expect("Error loading attachments") - .from_db() - }} - } - pub fn size_by_user(user_uuid: &str, conn: &DbConn) -> i64 { db_run! { conn: { let result: Option = attachments::table