mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-10 04:22:00 +10:00
fix: prevent CDNs from caching attachments (#562)
This commit is contained in:
@ -178,7 +178,7 @@ export class AttachmentController {
|
|||||||
const fileStream = await this.storageService.read(attachment.filePath);
|
const fileStream = await this.storageService.read(attachment.filePath);
|
||||||
res.headers({
|
res.headers({
|
||||||
'Content-Type': attachment.mimeType,
|
'Content-Type': attachment.mimeType,
|
||||||
'Cache-Control': 'public, max-age=3600',
|
'Cache-Control': 'private, max-age=3600',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!inlineFileExtensions.includes(attachment.fileExt)) {
|
if (!inlineFileExtensions.includes(attachment.fileExt)) {
|
||||||
@ -299,7 +299,7 @@ export class AttachmentController {
|
|||||||
const fileStream = await this.storageService.read(filePath);
|
const fileStream = await this.storageService.read(filePath);
|
||||||
res.headers({
|
res.headers({
|
||||||
'Content-Type': getMimeType(filePath),
|
'Content-Type': getMimeType(filePath),
|
||||||
'Cache-Control': 'public, max-age=86400',
|
'Cache-Control': 'private, max-age=86400',
|
||||||
});
|
});
|
||||||
return res.send(fileStream);
|
return res.send(fileStream);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user