Diffstat (limited to 'internal/client')
| -rw-r--r-- | internal/client/input/b2.go | 3 | ||||
| -rw-r--r-- | internal/client/input/input_client_interface.go | 1 | ||||
| -rw-r--r-- | internal/client/input/local_unix.go | 7 | ||||
| -rw-r--r-- | internal/client/output/b2.go | 3 | ||||
| -rw-r--r-- | internal/client/output/local_unix.go | 7 | ||||
| -rw-r--r-- | internal/client/output/output_client_interface.go | 3 |
6 files changed, 15 insertions, 9 deletions
diff --git a/internal/client/input/b2.go b/internal/client/input/b2.go index db68268..0092313 100644 --- a/internal/client/input/b2.go +++ b/internal/client/input/b2.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "slices" + "strconv" "strings" "github.com/Backblaze/blazer/b2" @@ -101,8 +102,8 @@ func (c *B2InputClient) ReadMetadata(path string) (*MetadataStruct, error) { FirstCreated: attrs.UploadTimestamp, LastModified: attrs.LastModified, Misc: attrs.Info, - Size: attrs.Size, } + metadata.Misc["Size"] = strconv.FormatInt(attrs.Size, 10) switch attrs.Status { case b2.Uploaded: diff --git a/internal/client/input/input_client_interface.go b/internal/client/input/input_client_interface.go index 4930aa0..5d12fa8 100644 --- a/internal/client/input/input_client_interface.go +++ b/internal/client/input/input_client_interface.go @@ -20,7 +20,6 @@ type MetadataStruct struct { ContentType string FirstCreated time.Time LastModified time.Time - Size int64 Misc map[string]string } diff --git a/internal/client/input/local_unix.go b/internal/client/input/local_unix.go index 27a7947..2df3a41 100644 --- a/internal/client/input/local_unix.go +++ b/internal/client/input/local_unix.go @@ -87,6 +87,10 @@ func (c *LocalUnixInputClient) ReadMetadata(path string) (*MetadataStruct, error stat_t := fileInfo.Sys().(*syscall.Stat_t) creationTime := time.Unix(stat_t.Ctim.Sec, stat_t.Ctim.Nsec) + misc := map[string]string{ + "Size": strconv.FormatInt(fileInfo.Size(), 10), + } + return &MetadataStruct{ Name: fileInfo.Name(), StorageType: "local-unix", @@ -94,8 +98,7 @@ func (c *LocalUnixInputClient) ReadMetadata(path string) (*MetadataStruct, error ContentType: mime.TypeByExtension("." + nodeExt), FirstCreated: creationTime, LastModified: fileInfo.ModTime(), - Size: fileInfo.Size(), - Misc: map[string]string{}, + Misc: misc, }, nil } diff --git a/internal/client/output/b2.go b/internal/client/output/b2.go index f53532a..e741e25 100644 --- a/internal/client/output/b2.go +++ b/internal/client/output/b2.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "strconv" "github.com/Backblaze/blazer/b2" "github.com/SayaAndy/saya-today-thumbnail-generator/config" @@ -69,8 +70,8 @@ func (c *B2OutputClient) ReadMetadata(path string) (*MetadataStruct, error) { FirstCreated: attrs.UploadTimestamp, LastModified: attrs.LastModified, Misc: attrs.Info, - Size: attrs.Size, } + metadata.Misc["Size"] = strconv.FormatInt(attrs.Size, 10) switch attrs.Status { case b2.Uploaded: diff --git a/internal/client/output/local_unix.go b/internal/client/output/local_unix.go index dd53e79..b106726 100644 --- a/internal/client/output/local_unix.go +++ b/internal/client/output/local_unix.go @@ -93,6 +93,10 @@ func (c *LocalUnixOutputClient) ReadMetadata(path string) (*MetadataStruct, erro stat_t := fileInfo.Sys().(*syscall.Stat_t) creationTime := time.Unix(stat_t.Ctim.Sec, stat_t.Ctim.Nsec) + misc := map[string]string{ + "Size": strconv.FormatInt(fileInfo.Size(), 10), + } + mddateOriginal := make([]byte, 0) switch c.attrMode { case "xattr": @@ -118,8 +122,7 @@ func (c *LocalUnixOutputClient) ReadMetadata(path string) (*MetadataStruct, erro ContentType: mime.TypeByExtension("." + nodeExt), FirstCreated: creationTime, LastModified: fileInfo.ModTime(), - Size: fileInfo.Size(), - Misc: map[string]string{}, + Misc: misc, }, nil } diff --git a/internal/client/output/output_client_interface.go b/internal/client/output/output_client_interface.go index c74851d..437895c 100644 --- a/internal/client/output/output_client_interface.go +++ b/internal/client/output/output_client_interface.go @@ -10,7 +10,7 @@ import ( type OutputClient interface { GetWriter(path string, inputMetadata *input.MetadataStruct) (io.WriteCloser, error) - ReadMetadata(path string) (*MetadataStruct, error) + ReadMetadata(string) (*MetadataStruct, error) IsMissing(path string) bool } @@ -22,7 +22,6 @@ type MetadataStruct struct { ContentType string FirstCreated time.Time LastModified time.Time - Size int64 Misc map[string]string } |