diff --git a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js index c8904b9dc5f..62d86433460 100644 --- a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js +++ b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js @@ -544,9 +544,9 @@ export default Mixin.create(ExtendableUploader, UppyS3Multipart, { _useXHRUploads() { this._uppyInstance.use(XHRUpload, { endpoint: getURL(`/uploads.json?client_id=${this.messageBus.clientId}`), - headers: { + headers: () => ({ "X-CSRF-Token": this.session.csrfToken, - }, + }), }); }, diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js index 7b708d915e3..60369704faf 100644 --- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js +++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js @@ -350,9 +350,9 @@ export default Mixin.create(UppyS3Multipart, ExtendableUploader, { _useXHRUploads() { this._uppyInstance.use(XHRUpload, { endpoint: this._xhrUploadUrl(), - headers: { + headers: () => ({ "X-CSRF-Token": this.session.csrfToken, - }, + }), }); },