Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
a16bde23
Commit
a16bde23
authored
Jan 29, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: tweak variable name
parent
c5a5f67f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
s3.go
plugin/storage/s3/s3.go
+3
-4
No files found.
plugin/storage/s3/s3.go
View file @
a16bde23
...
@@ -2,7 +2,6 @@ package s3
...
@@ -2,7 +2,6 @@ package s3
import
(
import
(
"context"
"context"
"errors"
"fmt"
"fmt"
"io"
"io"
"net/url"
"net/url"
...
@@ -15,7 +14,7 @@ import (
...
@@ -15,7 +14,7 @@ import (
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
awss3
"github.com/aws/aws-sdk-go-v2/service/s3"
awss3
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
errors2
"github.com/pkg/errors"
"github.com/pkg/errors"
)
)
const
LinkLifetime
=
24
*
time
.
Hour
const
LinkLifetime
=
24
*
time
.
Hour
...
@@ -110,7 +109,7 @@ func (client *Client) UploadFile(ctx context.Context, filename string, fileType
...
@@ -110,7 +109,7 @@ func (client *Client) UploadFile(ctx context.Context, filename string, fileType
func
(
client
*
Client
)
PreSignLink
(
ctx
context
.
Context
,
sourceLink
string
)
(
string
,
error
)
{
func
(
client
*
Client
)
PreSignLink
(
ctx
context
.
Context
,
sourceLink
string
)
(
string
,
error
)
{
u
,
err
:=
url
.
Parse
(
sourceLink
)
u
,
err
:=
url
.
Parse
(
sourceLink
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
errors
2
.
Wrapf
(
err
,
"parse URL"
)
return
""
,
errors
.
Wrapf
(
err
,
"parse URL"
)
}
}
// if link doesn't belong to storage, then return as-is.
// if link doesn't belong to storage, then return as-is.
// the empty hostname is corner-case for AWS native endpoint.
// the empty hostname is corner-case for AWS native endpoint.
...
@@ -135,7 +134,7 @@ func (client *Client) PreSignLink(ctx context.Context, sourceLink string) (strin
...
@@ -135,7 +134,7 @@ func (client *Client) PreSignLink(ctx context.Context, sourceLink string) (strin
Key
:
aws
.
String
(
filename
),
Key
:
aws
.
String
(
filename
),
},
awss3
.
WithPresignExpires
(
LinkLifetime
))
},
awss3
.
WithPresignExpires
(
LinkLifetime
))
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
errors
2
.
Wrapf
(
err
,
"pre-sign link"
)
return
""
,
errors
.
Wrapf
(
err
,
"pre-sign link"
)
}
}
return
req
.
URL
,
nil
return
req
.
URL
,
nil
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment