From 3f223a75141701cb67443542d66888dfe3618e20 Mon Sep 17 00:00:00 2001 From: Alex Martel <13215031+manofthepeace@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:06:00 -0500 Subject: [PATCH] Remove patched multer-rs --- Cargo.lock | 3 ++- Cargo.toml | 6 ------ src/api/core/ciphers.rs | 13 ------------- src/api/core/sends.rs | 26 -------------------------- 4 files changed, 2 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8bf1ee42..c2f2e281 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1516,7 +1516,8 @@ dependencies = [ [[package]] name = "multer" version = "2.0.4" -source = "git+https://github.com/BlackDex/multer-rs?rev=477d16b7fa0f361b5c2a5ba18a5b28bec6d26a8a#477d16b7fa0f361b5c2a5ba18a5b28bec6d26a8a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22" dependencies = [ "bytes", "encoding_rs", diff --git a/Cargo.toml b/Cargo.toml index 4f4e4f0f..54feb671 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -152,12 +152,6 @@ semver = "1.0.14" # Mainly used for the musl builds, since the default musl malloc is very slow mimalloc = { version = "0.1.32", features = ["secure"], default-features = false, optional = true } -[patch.crates-io] -# Using a patched version of multer-rs (Used by Rocket) to fix attachment/send file uploads -# Issue: https://github.com/dani-garcia/vaultwarden/issues/2644 -# Patch: https://github.com/BlackDex/multer-rs/commit/477d16b7fa0f361b5c2a5ba18a5b28bec6d26a8a -multer = { git = "https://github.com/BlackDex/multer-rs", rev = "477d16b7fa0f361b5c2a5ba18a5b28bec6d26a8a" } - # Strip debuginfo from the release builds # Also enable thin LTO for some optimizations [profile.release] diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index c72419b0..7077f905 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -999,19 +999,6 @@ async fn save_attachment( let mut data = data.into_inner(); - // There is a bug regarding uploading attachments/sends using the Mobile clients - // See: https://github.com/dani-garcia/vaultwarden/issues/2644 && https://github.com/bitwarden/mobile/issues/2018 - // This has been fixed via a PR: https://github.com/bitwarden/mobile/pull/2031, but hasn't landed in a new release yet. - // On the vaultwarden side this is temporarily fixed by using a custom multer library - // See: https://github.com/dani-garcia/vaultwarden/pull/2675 - // In any case we will match TempFile::File and not TempFile::Buffered, since Buffered will alter the contents. - if let TempFile::Buffered { - content: _, - } = &data.data - { - err!("Error reading attachment data. Please try an other client."); - } - if let Some(size_limit) = size_limit { if data.data.len() > size_limit { err!("Attachment storage limit exceeded with this file"); diff --git a/src/api/core/sends.rs b/src/api/core/sends.rs index e2107256..90fd560c 100644 --- a/src/api/core/sends.rs +++ b/src/api/core/sends.rs @@ -228,19 +228,6 @@ async fn post_send_file(data: Form>, headers: Headers, mut conn: err!("Send content is not a file"); } - // There is a bug regarding uploading attachments/sends using the Mobile clients - // See: https://github.com/dani-garcia/vaultwarden/issues/2644 && https://github.com/bitwarden/mobile/issues/2018 - // This has been fixed via a PR: https://github.com/bitwarden/mobile/pull/2031, but hasn't landed in a new release yet. - // On the vaultwarden side this is temporarily fixed by using a custom multer library - // See: https://github.com/dani-garcia/vaultwarden/pull/2675 - // In any case we will match TempFile::File and not TempFile::Buffered, since Buffered will alter the contents. - if let TempFile::Buffered { - content: _, - } = &data - { - err!("Error reading send file data. Please try an other client."); - } - let size = data.len(); if size > size_limit { err!("Attachment storage limit exceeded with this file"); @@ -339,19 +326,6 @@ async fn post_send_file_v2_data( let mut data = data.into_inner(); - // There is a bug regarding uploading attachments/sends using the Mobile clients - // See: https://github.com/dani-garcia/vaultwarden/issues/2644 && https://github.com/bitwarden/mobile/issues/2018 - // This has been fixed via a PR: https://github.com/bitwarden/mobile/pull/2031, but hasn't landed in a new release yet. - // On the vaultwarden side this is temporarily fixed by using a custom multer library - // See: https://github.com/dani-garcia/vaultwarden/pull/2675 - // In any case we will match TempFile::File and not TempFile::Buffered, since Buffered will alter the contents. - if let TempFile::Buffered { - content: _, - } = &data.data - { - err!("Error reading attachment data. Please try an other client."); - } - if let Some(send) = Send::find_by_uuid(&send_uuid, &mut conn).await { let folder_path = tokio::fs::canonicalize(&CONFIG.sends_folder()).await?.join(&send_uuid); let file_path = folder_path.join(&file_id);