diff --git a/src/matrix/net/MediaRepository.js b/src/matrix/net/MediaRepository.js index 1bba287d..cc7721ab 100644 --- a/src/matrix/net/MediaRepository.js +++ b/src/matrix/net/MediaRepository.js @@ -55,7 +55,7 @@ export class MediaRepository { async downloadEncryptedFile(fileEntry) { const url = this.mxcUrl(fileEntry.url); - const {body: encryptedBuffer} = await this._request(url, {format: "buffer"}).response(); + const {body: encryptedBuffer} = await this._request(url, {format: "buffer", cache: true}).response(); const decryptedBuffer = await decryptAttachment(this._cryptoDriver, encryptedBuffer, fileEntry); return decryptedBuffer; } diff --git a/src/matrix/net/request/fetch.js b/src/matrix/net/request/fetch.js index fa7f8727..0f8f9b52 100644 --- a/src/matrix/net/request/fetch.js +++ b/src/matrix/net/request/fetch.js @@ -51,7 +51,7 @@ class RequestResult { } export function createFetchRequest(createTimeout) { - return function fetchRequest(url, {method, headers, body, timeout, format}) { + return function fetchRequest(url, {method, headers, body, timeout, format, cache = false}) { const controller = typeof AbortController === "function" ? new AbortController() : null; let options = {method, body}; if (controller) { @@ -59,7 +59,9 @@ export function createFetchRequest(createTimeout) { signal: controller.signal }); } - url = addCacheBuster(url); + if (!cache) { + url = addCacheBuster(url); + } options = Object.assign(options, { mode: "cors", credentials: "omit",