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) { async downloadEncryptedFile(fileEntry) {
const url = this.mxcUrl(fileEntry.url); 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); const decryptedBuffer = await decryptAttachment(this._cryptoDriver, encryptedBuffer, fileEntry);
return decryptedBuffer; return decryptedBuffer;
} }

View file

@ -51,7 +51,7 @@ class RequestResult {
} }
export function createFetchRequest(createTimeout) { 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; const controller = typeof AbortController === "function" ? new AbortController() : null;
let options = {method, body}; let options = {method, body};
if (controller) { if (controller) {
@ -59,7 +59,9 @@ export function createFetchRequest(createTimeout) {
signal: controller.signal signal: controller.signal
}); });
} }
if (!cache) {
url = addCacheBuster(url); url = addCacheBuster(url);
}
options = Object.assign(options, { options = Object.assign(options, {
mode: "cors", mode: "cors",
credentials: "omit", credentials: "omit",