Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: update resource with id (#3405)

Timothy52ebfd703c94
diff --git a/server/service/s3_object_presigner/s3_object_presigner.go b/server/service/s3_object_presigner/s3_object_presigner.go
index f40615e7e..29164bd8a 100644
--- a/server/service/s3_object_presigner/s3_object_presigner.go
+++ b/server/service/s3_object_presigner/s3_object_presigner.go
@@ -45,9 +45,9 @@ func (p *S3ObjectPresigner) CheckAndPresign(ctx context.Context) {
}
if s3ObjectPayload.LastPresignedTime != nil {
- // Skip if the presigned URL is still valid for the next 6 days.
- // The default expiration time is 7 days.
- if time.Now().Before(s3ObjectPayload.LastPresignedTime.AsTime().Add(6 * 24 * time.Hour)) {
+ // Skip if the presigned URL is still valid for the next 4 days.
+ // The expiration time is set to 5 days.
+ if time.Now().Before(s3ObjectPayload.LastPresignedTime.AsTime().Add(4 * 24 * time.Hour)) {
continue
}
}
@@ -74,6 +74,7 @@ func (p *S3ObjectPresigner) CheckAndPresign(ctx context.Context) {
s3ObjectPayload.S3Config = s3Config
s3ObjectPayload.LastPresignedTime = timestamppb.New(time.Now())
if err := p.Store.UpdateResource(ctx, &store.UpdateResource{
+ ID: resource.ID,
Reference: &presignURL,
Payload: &storepb.ResourcePayload{
Payload: &storepb.ResourcePayload_S3Object_{