Browse Source
Merge pull request #1566 from taozix/master
return x-amz-tag-count header when GET object.
pull/1569/head
Chris Lu
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
14 additions and
1 deletions
-
weed/s3api/filer_util_tags.go
-
weed/server/filer_server_handlers_read.go
|
|
@ -7,7 +7,7 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
const ( |
|
|
|
S3TAG_PREFIX = "s3-" |
|
|
|
S3TAG_PREFIX = "x-amz-tagging-" |
|
|
|
) |
|
|
|
|
|
|
|
func (s3a *S3ApiServer) getTags(parentDirectoryPath string, entryName string) (tags map[string]string, err error) { |
|
|
|
|
|
@ -93,6 +93,19 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//set tag count
|
|
|
|
if r.Method == "GET" { |
|
|
|
tagCount := 0 |
|
|
|
for k, _ := range entry.Extended { |
|
|
|
if strings.HasPrefix(k, "x-amz-tagging-") { |
|
|
|
tagCount++ |
|
|
|
} |
|
|
|
} |
|
|
|
if tagCount > 0 { |
|
|
|
w.Header().Set("x-amz-tag-count", strconv.Itoa(tagCount)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// set etag
|
|
|
|
etag := filer.ETagEntry(entry) |
|
|
|
if inm := r.Header.Get("If-None-Match"); inm == "\""+etag+"\"" { |
|
|
|