fix: don't send connected-account key as JMAP accountId when sharing files #408

This commit is contained in:
Linus Rath
2026-06-12 00:36:45 +02:00
parent 1e63e2469a
commit 8df483d8c7
+7 -4
View File
@@ -1015,11 +1015,14 @@ export const useFileStore = create<FileState>((set, get) => ({
},
shareResource: async (id: string, principalId: string, rights: FileNodeRights | null) => {
const { client, currentAccountId, refresh } = get();
const { client, refresh } = get();
if (!client) return;
// Owned nodes are browsed in the current account, so their ids are not
// namespaced; route the share to that account (defaults to the files account).
await client.setFileNodeShare(id, principalId, rights, currentAccountId ?? undefined);
// currentAccountId is the webmail's connected-account key ("user@host"),
// not a JMAP account id - Stalwart parses accountId strictly while
// deserializing the request, so sending it rejects the whole call with
// notRequest. The client is already the per-account client; let
// setFileNodeShare resolve its own files account.
await client.setFileNodeShare(id, principalId, rights);
await refresh();
},