Skip to content

Commit

Permalink
changelog,command/presign: add missing points, fix cosmetic issues fo…
Browse files Browse the repository at this point in the history
…r `presign` command (#644)
  • Loading branch information
igungor committed Aug 21, 2023
1 parent db6b53f commit 336eb28
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 9 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Expand Up @@ -2,25 +2,29 @@

## not released yet

#### Breaking changes

#### Features
- Added `--content-disposition` flag to `cp` command. ([#569](https://github.com/peak/s5cmd/issues/569))
- Added `--show-fullpath` flag to `ls`. ([#596](https://github.com/peak/s5cmd/issues/596))
- Added `pipe` command. ([#182](https://github.com/peak/s5cmd/issues/182))
- Added `presign` command. ([#634](https://github.com/peak/s5cmd/pull/634)) [@zemul](https://github.com/zemul)
- Added `--show-progress` flag to `cp` to show a progress bar. ([#51](https://github.com/peak/s5cmd/issues/51))
- Added `--metadata` flag to `cp` and `pipe` to set arbitrary metadata for the objects. ([#537](https://github.com/peak/s5cmd/issues/537))
- Added `--include` flag to `cp`, `rm` and `sync` commands. ([#516](https://github.com/peak/s5cmd/issues/516))
- Added `--content-disposition` flag to `cp` command. ([#569](https://github.com/peak/s5cmd/issues/569))
- Added `--show-fullpath` flag to `ls`. ([#596](https://github.com/peak/s5cmd/issues/596))

#### Improvements
- Implemented concurrent multipart download support for `cat`. ([#245](https://github.com/peak/s5cmd/issues/245))
- Upgraded minimum required Go version to 1.19. ([#583](https://github.com/peak/s5cmd/pull/583))
- `ListObjectsV2` S3 API is enabled for Google Cloud Storage. ([#617](https://github.com/peak/s5cmd/pull/617))
- Added installation instructions for FreeBSD. ([#573](https://github.com/peak/s5cmd/pull/573)) [@ehaupt](https://github.com/ehaupt)
- Added `ppc64le` support. ([#552](https://github.com/peak/s5cmd/pull/552)) [@mgiessing](https://github.com/mgiessing)

#### Bugfixes
- Fixed a bug that causes `sync` command with whitespaced flag value to fail. ([#541](https://github.com/peak/s5cmd/issues/541))
- Fixed a bug that causes `sync` command with whitespaced flag value to fail. ([#541](https://github.com/peak/s5cmd/issues/541)) [ataberkgrl](https://github.com/ataberkgrl)
- Fixed a bug introduced with `external sort` support in `sync` command which prevents `sync` to an empty destination with `--delete` option. ([#576](https://github.com/peak/s5cmd/issues/576))
- Fixed a bug in `sync` command, which previously caused the command to continue running even if an error was received from the destination bucket. ([#564](https://github.com/peak/s5cmd/issues/564))
- Fixed a bug that causes local files to be lost if downloads fail. ([#479](https://github.com/peak/s5cmd/issues/479))
- Fixed a bug where `cp` command could not upload a non-regular file to remote destination. ([#618](https://github.com/peak/s5cmd/pull/618))
- Fixed a crash where a file or a remote object is removed or renamed after it is listed to be operated on. ([#620](https://github.com/peak/s5cmd/pull/620))

## v2.1.0 - 19 Jun 2023

Expand Down
2 changes: 1 addition & 1 deletion command/presign.go
Expand Up @@ -106,7 +106,7 @@ func (c Presign) Run(ctx context.Context) error {

func validatePresignCommand(c *cli.Context) error {
if c.Args().Len() != 1 {
return fmt.Errorf("expected only one argument")
return fmt.Errorf("expected remote object url")
}

src, err := url.New(c.Args().Get(0), url.WithVersion(c.String("version-id")))
Expand Down
35 changes: 35 additions & 0 deletions e2e/presign_test.go
@@ -0,0 +1,35 @@
package e2e

import (
"fmt"
"testing"

"gotest.tools/v3/icmd"
)

func TestPresign(t *testing.T) {
t.Parallel()

s3client, s5cmd := setup(t)

bucket := s3BucketFromTestName(t)

createBucket(t, s3client, bucket)

const (
filename = "test.txt"
content = "file content"
)
putFile(t, s3client, bucket, filename, content)

src := fmt.Sprintf("s3://%v/%v", bucket, filename)

cmd := s5cmd("presign", src)
result := icmd.RunCmd(cmd)

result.Assert(t, icmd.Success)

assertLines(t, result.Stdout(), map[int]compareFunc{
0: contains(filename),
})
}
5 changes: 2 additions & 3 deletions storage/s3.go
Expand Up @@ -581,7 +581,6 @@ func (s *S3) Read(ctx context.Context, src *url.URL) (io.ReadCloser, error) {
return resp.Body, nil
}

// Presign fetches the remote object url and returns its.
func (s *S3) Presign(ctx context.Context, from *url.URL, expire time.Duration) (string, error) {
input := &s3.GetObjectInput{
Bucket: aws.String(from.Bucket),
Expand All @@ -590,8 +589,8 @@ func (s *S3) Presign(ctx context.Context, from *url.URL, expire time.Duration) (
}

req, _ := s.api.GetObjectRequest(input)
url, err := req.Presign(expire)
return url, err

return req.Presign(expire)
}

// Get is a multipart download operation which downloads S3 objects into any
Expand Down

0 comments on commit 336eb28

Please sign in to comment.