Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update minio-go #2299

Merged
merged 1 commit into from
Nov 8, 2017
Merged

Update minio-go #2299

merged 1 commit into from
Nov 8, 2017

Conversation

harshavardhana
Copy link
Member

- Avoid setting server encryption headers with x-amz-meta (minio#859)
- Remove redirectHeaders method (minio#857)
- Honor file pointer set in PutObject method (minio#856)
- Fix docs and add a validator tool for our api docs (minio#850)
- requestMetadata should take the md5 and sha256 with expected encodings. (minio#852)
- Added a new method SetUserMetadata to the PostPolicy (minio#839)
- Do not need to strictly validate request params in Presign API. (minio#832)
@codecov-io
Copy link

Codecov Report

Merging #2299 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2299   +/-   ##
======================================
  Coverage    10.7%   10.7%           
======================================
  Files         102     102           
  Lines        9916    9916           
======================================
  Hits         1062    1062           
  Misses       8716    8716           
  Partials      138     138

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab6b2a8...d851adf. Read the comment docs.

Copy link
Collaborator

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified basic commands manually. LGTM

@@ -40,6 +34,26 @@ func isObject(reader io.Reader) (ok bool) {
// Verify if reader is a generic ReaderAt
func isReadAt(reader io.Reader) (ok bool) {
_, ok = reader.(io.ReaderAt)
if ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ok { => if _, ok = reader.(io.ReaderAt); ok {

if ok {
var v *os.File
v, ok = reader.(*os.File)
if ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ok { => if v, ok = reader.(*os.File); ok {

// and such a functionality is used in the subsequent code path.
if isFile(reader) || !isObject(reader) && isReadAt(reader) {
if !isObject(reader) && isReadAt(reader) {
// Verify if the reader implements ReadAt and it is not a *minio.Object then we will use parallel uploader.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to have the comment come before the command, like:

	// Verify if the reader implements ReadAt and it is not a *minio.Object then we will use parallel uploader.
	if !isObject(reader) && isReadAt(reader) {

"/dev/stdin",
"/dev/stdout",
"/dev/stderr",
} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, this looks much better, and more readable:

                     for _, f := range []string{"/dev/stdin",
                                                "/dev/stdout",
                                                "/dev/stderr"}
                     {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting is automatic by gofmt and this PR has nothing to do with these chnages, so won't be making these changes.

@@ -237,8 +223,7 @@ func privateNew(endpoint string, creds *credentials.Credentials, secure bool, re

// Instantiate http client and bucket location cache.
clnt.httpClient = &http.Client{
Transport: defaultMinioTransport,
CheckRedirect: redirectHeaders,
Transport: defaultMinioTransport,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can combine all in one line:

clnt.httpClient = &http.Client{Transport: defaultMinioTransport}

@@ -74,8 +62,7 @@ func NewIAM(endpoint string) *Credentials {
}
p := &IAM{
Client: &http.Client{
Transport: http.DefaultTransport,
CheckRedirect: redirectHeaders,
Transport: http.DefaultTransport,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine them all in 2 lines:

p := &IAM { Client: &http.Client{Transport: http.DefaultTransport},
            endpoint: endpoint }

@@ -253,17 +251,27 @@ func writeCanonicalizedHeaders(buf *bytes.Buffer, req http.Request) {
}
}

// The following list is already sorted and should always be, otherwise we could
// have signature-related issues
// AWS S3 Signature V2 calculation rule is give here:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in comment:
// AWS S3 Signature V2 calculation rule is give here:
=???=> given

// SetUserMetadata - Set user metadata as a key/value couple.
// Can be retrieved through a HEAD request or an event.
func (p *PostPolicy) SetUserMetadata(key string, value string) error {
if strings.TrimSpace(key) == "" || key == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.TrimSpace(key) for key="" returns "".
So, the 2nd condition is covered in the 1st part.
Then we can simplify the if condition as:

if strings.TrimSpace(key) == "" {

@@ -38,18 +40,18 @@ func xmlDecoder(body io.Reader, v interface{}) error {
return d.Decode(v)
}

// sum256 calculate sha256 sum for an input byte array.
func sum256(data []byte) []byte {
// sum256 calculate sha256sum for an input byte array, returns hex encoded.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// sum256 calculate sha256sum ... => // sum256Hex calculates sha256sum ...`

@harshavardhana
Copy link
Member Author

harshavardhana commented Nov 7, 2017

I cannot make your changes in this PR @ebozduman you should open them separately in minio-go this is Just a vendorized changes from minio-go master.

@deekoder deekoder merged commit 014d094 into minio:master Nov 8, 2017
@harshavardhana harshavardhana deleted the fix-minio-go branch November 8, 2017 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants