mirror of
https://github.com/openziti/zrok.git
synced 2025-08-17 11:21:07 +02:00
modification time and UTC (#438)
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
type FilesystemTargetConfig struct {
|
||||
@ -52,7 +53,7 @@ func (t *FilesystemTarget) recurse(path string, d fs.DirEntry, err error) error
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
etag = fmt.Sprintf(`"%x%x"`, fi.ModTime().UnixNano(), fi.Size())
|
||||
etag = fmt.Sprintf(`"%x%x"`, fi.ModTime().UTC().UnixNano(), fi.Size())
|
||||
}
|
||||
t.tree = append(t.tree, &Object{path, fi.Size(), fi.ModTime(), etag})
|
||||
}
|
||||
@ -79,3 +80,11 @@ func (t *FilesystemTarget) WriteStream(path string, stream io.Reader, mode os.Fi
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *FilesystemTarget) SetModificationTime(path string, mtime time.Time) error {
|
||||
targetPath := filepath.Join(t.cfg.Root, path)
|
||||
if err := os.Chtimes(targetPath, time.Now(), mtime); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user