prevent browser from caching images/files, fixes #2378

This commit is contained in:
zadam 2021-11-25 20:24:42 +01:00
parent 8c11d022fb
commit 564366861e
3 changed files with 3 additions and 3 deletions

View file

@ -57,9 +57,7 @@ class ImageTypeWidget extends TypeWidget {
}
async doRefresh(note) {
const imageHash = utils.randomString(10);
this.$imageView.prop("src", `api/images/${note.noteId}/${note.title}?${imageHash}`);
this.$imageView.prop("src", `api/images/${note.noteId}/${note.title}`);
}
copyImageToClipboardEvent({ntxId}) {

View file

@ -60,6 +60,7 @@ function downloadNoteFile(noteId, res, contentDisposition = true) {
res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
}
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
res.setHeader('Content-Type', note.mime);
res.send(note.getContent());

View file

@ -20,6 +20,7 @@ function returnImage(req, res) {
}
res.set('Content-Type', image.mime);
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
res.send(image.getContent());
}