Skip to content

Commit

Permalink
Merge pull request #81 from lytics/add_size_metadata_gcs
Browse files Browse the repository at this point in the history
Add size to metadata in google driver
  • Loading branch information
ajroetker authored Mar 11, 2020
2 parents c6a88c7 + 0637739 commit adf0db3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion google/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"path"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -308,10 +309,15 @@ type object struct {
}

func newObject(g *GcsFS, o *storage.ObjectAttrs) *object {
metadata := o.Metadata
if metadata == nil {
metadata = make(map[string]string)
}
metadata["content_length"] = strconv.FormatInt(o.Size, 10)
return &object{
name: o.Name,
updated: o.Updated,
metadata: o.Metadata,
metadata: metadata,
gcsb: g.gcsb(),
bucket: g.bucket,
cachepath: cloudstorage.CachePathObj(g.cachepath, o.Name, g.Id),
Expand Down

0 comments on commit adf0db3

Please sign in to comment.