mirror of
https://github.com/usememos/memos.git
synced 2025-03-15 02:00:09 +01:00
fix: update resource with id (#3405)
* chore: update presign expires * fix: update resource with id --------- Co-authored-by: timothy <timothy123890511@gmail.com>
This commit is contained in:
parent
8f6d38719f
commit
52ebfd703c
@ -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_{
|
||||
|
Loading…
x
Reference in New Issue
Block a user