mirror of
https://github.com/rharkor/caching-for-turbo.git
synced 2025-06-09 09:35:17 +09:00
fix: s3
This commit is contained in:
parent
fd07872c66
commit
883aaa7a2a
3 changed files with 27 additions and 22 deletions
13
dist/setup/index.js
generated
vendored
13
dist/setup/index.js
generated
vendored
|
@ -196618,6 +196618,7 @@ var lib_storage_dist_cjs = __nccwpck_require__(22358);
|
|||
|
||||
|
||||
|
||||
|
||||
const getS3Provider = () => {
|
||||
const s3AccessKeyId = core.getInput('s3-access-key-id');
|
||||
const s3SecretAccessKey = core.getInput('s3-secret-access-key');
|
||||
|
@ -196640,14 +196641,8 @@ const getS3Provider = () => {
|
|||
secretAccessKey: s3SecretAccessKey
|
||||
}
|
||||
});
|
||||
const getObjectKey = (hash, tag) => {
|
||||
if (tag) {
|
||||
return `${s3Prefix}${hash}#${tag}`;
|
||||
}
|
||||
return `${s3Prefix}${hash}`;
|
||||
};
|
||||
const save = async (ctx, hash, tag, stream) => {
|
||||
const objectKey = getObjectKey(hash, tag);
|
||||
const objectKey = getCacheKey(hash, tag);
|
||||
try {
|
||||
// Use the S3 Upload utility which handles multipart uploads for large files
|
||||
const upload = new lib_storage_dist_cjs.Upload({
|
||||
|
@ -196669,7 +196664,7 @@ const getS3Provider = () => {
|
|||
};
|
||||
const get = async (ctx, hash) => {
|
||||
// First try to get with just the hash
|
||||
const objectKey = getObjectKey(hash);
|
||||
const objectKey = getCacheKey(hash);
|
||||
try {
|
||||
// Try to find the object
|
||||
const listCommand = new dist_cjs.ListObjectsV2Command({
|
||||
|
@ -196725,7 +196720,7 @@ const getS3Provider = () => {
|
|||
try {
|
||||
const deleteCommand = new dist_cjs.DeleteObjectCommand({
|
||||
Bucket: s3Bucket,
|
||||
Key: hash.startsWith(s3Prefix) ? hash : getObjectKey(hash)
|
||||
Key: getCacheKey(hash)
|
||||
});
|
||||
await s3Client.send(deleteCommand);
|
||||
}
|
||||
|
|
2
dist/setup/index.js.map
generated
vendored
2
dist/setup/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue