summaryrefslogtreecommitdiff
path: root/internal/client/output/local_unix.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'internal/client/output/local_unix.go')
-rw-r--r--internal/client/output/local_unix.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/client/output/local_unix.go b/internal/client/output/local_unix.go
index 798be3b..6f9a7b3 100644
--- a/internal/client/output/local_unix.go
+++ b/internal/client/output/local_unix.go
@@ -3,6 +3,7 @@ package output
import (
"fmt"
"io"
+ "log/slog"
"mime"
"os"
"strconv"
@@ -43,7 +44,7 @@ func NewLocalUnixOutputClient(cfg *config.OutputConfig) (OutputClient, error) {
return &LocalUnixOutputClient{localCfg.Path, uint32(fpm), uint32(dpm), localCfg.AttributesImplementation}, nil
}
-func (c *LocalUnixOutputClient) GetWriter(path string, inputMetadata *input.MetadataStruct) (io.WriteCloser, error) {
+func (c *LocalUnixOutputClient) GetWriter(path string, inputMetadata *input.MetadataStruct, _ string) (io.WriteCloser, error) {
pathSegments := strings.Split(path, "/")
dirpath := strings.Join(pathSegments[0:len(pathSegments)-1], "/")
if err := os.MkdirAll(c.path+dirpath, os.FileMode(c.dirMode)); err != nil {
@@ -90,18 +91,15 @@ 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),
- }
+ creationTime := time.Unix(stat_t.Ctimespec.Sec, stat_t.Ctimespec.Nsec)
mddateOriginal := make([]byte, 0)
switch c.attrMode {
case "xattr":
sz, err := unix.Getxattr(c.path+path, "user.originalfile.mddate", nil)
if err != nil {
- return nil, fmt.Errorf("fail to get size of user.originalfile.mddate attribute: %w", err)
+ slog.Warn("fail to get size of user.originalfile.mddate attribute, proceeding as if no such attribute is there", slog.String("error", err.Error()))
+ break
}
mddateOriginal = make([]byte, sz)
if _, err = unix.Getxattr(c.path+path, "user.originalfile.mddate", mddateOriginal); err != nil {
@@ -120,7 +118,8 @@ func (c *LocalUnixOutputClient) ReadMetadata(path string) (*MetadataStruct, erro
ContentType: mime.TypeByExtension("." + nodeExt),
FirstCreated: creationTime,
LastModified: fileInfo.ModTime(),
- Misc: misc,
+ Size: fileInfo.Size(),
+ Misc: map[string]string{},
}, nil
}