core: use etag when proxy files

This commit is contained in:
undefined committed 2021-08-23 12:04:11 +08:00
1 parent ebe0a08d3e
commit bff83350a0
5 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -116,10 +116,10 @@ export class FSDownloadHandler extends Handler {
);
return;
}
this.response.etag = file.etag;
const type = lookup(filename).toString();
const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => type.includes(i)).length;
if (shouldProxy && file.size! < 32 * 1024 * 1024) {
this.response.etag = file.etag;
this.response.body = await storage.get(target);
this.response.type = file['Content-Type'] || type;
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;