Repository: dani-garcia/vaultwarden

Issue #1920: No attachment Upload from within Organization possible 
Created: 2021-08-18T15:44:16Z
Hi,
first of all: Great product and I love using it. Many thanks for all the work you put into this project.
Recently (since Version 1.22) I have a specific problem with attachment-uploads from within organization from browser:
Browser: recent / up to current date Chrome or Firefox (even Nightly)
OS: Windows / Linux / OS X  (I think it doesn't matter)
Working Case

I log into Vaultwarden
I go into one of the shown collections (from my organization, but without first clicking on the organization on the right)
I create an entry or update an entry with putting an attachment
I select the attachment and click on save
everything is fine; green success popup

debug-log for the working case :
vaultwarden-app    | [2021-08-18 17:33:15.410][response][INFO] POST /api/ciphers/<uuid>/attachment/v2 (post_attachment_v2) => 200 OK
vaultwarden-app    | [2021-08-18 17:33:15.457][request][INFO] POST /api/ciphers/818cd64e-118d-41b4-8c73-3f03fa86ed71/attachment/40ec0aa27af164246f3f
vaultwarden-app    | [2021-08-18 17:33:15.461][multipart::server][INFO] Multipart::with_boundary(_, "----WebKitFormBoundaryvURmJvJFnNYwrhsg")
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::field][DEBUG] ReadEntry::read_entry()
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server][DEBUG] Consume boundary!
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Boundary not found yet
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Before search Buf len: 365 Search idx: 0 State: Searching
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] After search Buf len: 365 Search idx: 0 State: BoundaryRead
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Discarding 0 bytes
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Consume! amt: 0 true amt: 0
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Before search Buf len: 323 Search idx: 0 State: Searching
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] After search Buf len: 323 Search idx: 279 State: BoundaryRead
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Subtract two!
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::field][DEBUG] Parsed headers: [StrHeader { name: "Content-Disposition", val: "form-data; name=\"data\"; filename=\"2.ydPzPSnFCMzmMpvBb6oaVg==|8gLWn/ypMs7MLbwWMiQzHg==|z5AtkCptnEMkCP8q1ot+a2sbWzZPjU+0+gAUA2REKHk=\"" }, StrHeader { name: "Content-Type", val: "application/octet-stream" }]
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::field][DEBUG] Found Content-Type: "application/octet-stream"
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Consume! amt: 196 true amt: 196
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Before search Buf len: 127 Search idx: 81 State: BoundaryRead
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Consume! amt: 0 true amt: 0
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Before search Buf len: 127 Search idx: 81 State: BoundaryRead
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Consume! amt: 0 true amt: 0
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Before search Buf len: 127 Search idx: 81 State: BoundaryRead
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Consume! amt: 81 true amt: 81
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::boundary][DEBUG] Before search Buf len: 46 Search idx: 0 State: BoundaryRead
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server::field][DEBUG] ReadEntry::read_entry()
vaultwarden-app    | [2021-08-18 17:33:15.462][multipart::server][DEBUG] Consume boundary!
vaultwarden-app    | [2021-08-18 17:33:15.466][response][INFO] POST /api/ciphers/<uuid>/attachment/<attachment_id> multipart/form-data (post_attachment_v2_data) => 200 OK
vaultwarden-app    | [2021-08-18 17:33:15.544][parity_ws::handler][DEBUG] Handler received:
vaultwarden-app    | <FRAME>
vaultwarden-app    | final: true
vaultwarden-app    | reserved: false false false
vaultwarden-app    | opcode: BINARY
vaultwarden-app    | length: 5
vaultwarden-app    | payload length: 3
vaultwarden-app    | payload: 0x2916
vaultwarden-app    |

The problematic case

I log into Vaultwarden
On the right I first click on my Organization
I go into one of the shown collections
I create an entry or update an entry with putting an attachment
I select the attachment and click on save
I receive an error popup
a) in Chrome: cannot read property 'id' of null
b) in Firefox: s is null

debug-log for the problematic case:
vaultwarden-app    | [2021-08-18 17:32:10.032][request][INFO] POST /api/ciphers/818cd64e-118d-41b4-8c73-3f03fa86ed71/attachment/v2
vaultwarden-app    | [2021-08-18 17:32:10.054][response][INFO] POST /api/ciphers/<uuid>/attachment/v2 (post_attachment_v2) => 200 OK

The Vaultwarden LOG_LEVEL debug does not show anything useful, but maybe the popup-hints are already leading into a good direction?
I would be grateful for help/a fix if possible.

Duplicate issue #1982: Vaultwarden (running in docker on Cloudron) - attachments do not work properly in Organizations but fine in personal account.
Created: 2021-09-18T21:37:51Z
Uploading an attachment in "My Vault" works without issue.
If I switch to one of my organizations, creating and uploading a document fails with

Item shows up as present but cannot be downloaded:

This is repeatable in every Organisation

Closing comment (2021-09-18T21:50:37Z): This looks like a duplicate of #1920. The fix (#1922) is not in a released version yet.