Skip to content

Commit

Permalink
Adding a header check for compatibility support
Browse files Browse the repository at this point in the history
  • Loading branch information
zveinn committed Jan 8, 2024
1 parent 8397688 commit 7b33363
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api-get-object-attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package minio
import (
"context"
"encoding/xml"
"errors"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -173,8 +174,14 @@ func (c *Client) GetObjectAttributes(ctx context.Context, bucketName, objectName
if err != nil {
return ObjectAttributes{}, err
}

defer closeResponse(resp)

hasEtag := resp.Header.Get(Etag)
if hasEtag != "" {
return ObjectAttributes{}, errors.New("getObjectAttributes is not supported by the current endpoint version")
}

if resp.StatusCode != http.StatusOK {
ER := new(ErrorResponse)
if err := xml.NewDecoder(resp.Body).Decode(ER); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ const (
)

const (
// Response Headers

Check failure on line 72 in constants.go

View workflow job for this annotation

GitHub Actions / Test on Go 1.20.x and ubuntu-latest

exported: comment on exported const Etag should be of the form "Etag ..." (revive)

Check failure on line 72 in constants.go

View workflow job for this annotation

GitHub Actions / Test on Go 1.21.x and ubuntu-latest

exported: comment on exported const Etag should be of the form "Etag ..." (revive)
Etag = "ETag"

// Storage class header.
amzStorageClass = "X-Amz-Storage-Class"
Expand Down

0 comments on commit 7b33363

Please sign in to comment.