don't disable cache for media repository downloads

This commit is contained in:
Bruno Windels 2020-10-26 09:58:39 +01:00
parent cbd48aa528
commit 4fd71279cf
2 changed files with 5 additions and 3 deletions

View file

@ -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;
}

View file

@ -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",