mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
don't disable cache for media repository downloads
This commit is contained in:
parent
cbd48aa528
commit
4fd71279cf
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user