Skip to content

Commit

Permalink
Fix attachment uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
tulpenkiste committed Dec 17, 2024
1 parent 1dd0fbb commit db102ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/client/components/state/stores/Draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ export class Draft extends AbstractStore<"draft", TypeDraft> {
const body = new FormData();
const { file } = this.getFile(fileId);
body.set("file", file);
const token = this.state.auth.getSession()?.token ?? "";

// We have to use XMLHttpRequest because modern fetch duplex streams require QUIC or HTTP/2
const xhr = new XMLHttpRequest();
Expand All @@ -323,8 +324,11 @@ export class Draft extends AbstractStore<"draft", TypeDraft> {
xhr.open(
"POST",
`${client.configuration!.features.autumn.url}/attachments`,
true
true,
);

xhr.setRequestHeader("X-Session-Token", token);

xhr.send(body);
});

Expand Down

0 comments on commit db102ff

Please sign in to comment.