added missing cache directives to media adapter serving

This commit is contained in:
dswbx
2025-03-03 07:14:01 +01:00
parent 3bf3bb32a4
commit 6c1eea76e5
4 changed files with 32 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ import type {
PutObjectRequest,
} from "@aws-sdk/client-s3";
import { AwsClient, isDebug } from "core";
import { type Static, Type, isFile, parse, pickHeaders } from "core/utils";
import { type Static, Type, isFile, parse, pickHeaders, pickHeaders2 } from "core/utils";
import { transform } from "lodash-es";
import type { FileBody, FileListObject, StorageAdapter } from "../Storage";
@@ -171,7 +171,13 @@ export class StorageS3Adapter extends AwsClient implements StorageAdapter {
const url = this.getUrl(key);
const res = await this.fetch(url, {
method: "GET",
headers: pickHeaders(headers, ["range"]),
headers: pickHeaders2(headers, [
"range",
"if-none-match",
"accept-encoding",
"accept",
"if-modified-since",
]),
});
// Response has to be copied, because of middlewares that might set headers