mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
+13
-4
@@ -165,15 +165,24 @@ async function deleteFile(key) {
|
||||
// A presigned URL arriving there collides with the proxy's own signature and
|
||||
// Garage rejects the request (400 "Header `x-amz-date` should be signed").
|
||||
// See getPublicUrl() below for the browser-facing equivalent.
|
||||
// TEMPORARY:
|
||||
// The problem is this line do not tell for each of development machines
|
||||
// which ones should be called whether it's for PUBLIC_URL or LOCAL_ENDPOINT itself.
|
||||
//
|
||||
async function getSignedDownloadUrl(key, expiresInSeconds = 3600) {
|
||||
const client = getPublicClient();
|
||||
|
||||
return getSignedUrl(
|
||||
s3,
|
||||
new GetObjectCommand({ Bucket: DEFAULT_BUCKET, Key: key }),
|
||||
{ expiresIn: expiresInSeconds }
|
||||
client,
|
||||
new GetObjectCommand({
|
||||
Bucket: DEFAULT_BUCKET,
|
||||
Key: key,
|
||||
}),
|
||||
{
|
||||
expiresIn: expiresInSeconds,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ─── getPublicUrl ─────────────────────────────────────────────────────────────
|
||||
//
|
||||
// Browser-facing pre-signed GET URL, signed against S3_PUBLIC_URL. Safe again
|
||||
|
||||
Reference in New Issue
Block a user