From baa8e51b3e7b8f7c994b1ba579b91a8b01739006 Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Sun, 24 Aug 2025 23:52:28 +0000 Subject: [PATCH] clean up some log messages --- internal/resource/file.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/resource/file.go b/internal/resource/file.go index 92252e1..2fe188a 100644 --- a/internal/resource/file.go +++ b/internal/resource/file.go @@ -27,6 +27,7 @@ import ( "strings" "embed" "compress/gzip" + "path/filepath" ) const ( @@ -99,7 +100,6 @@ type File struct { FileType FileType `json:"filetype" yaml:"filetype"` SerializeContent bool `json:"serializecontent,omitempty" yaml:"serializecontent,omitempty"` GzipContent bool `json:"gzipcontent,omitempty" yaml:"gzipcontent,omitempty"` - Resources data.ResourceMapper `json:"-" yaml:"-"` } type ResourceFileInfo struct { @@ -135,10 +135,6 @@ func (f *File) Init(u data.URIParser) error { return f.SetParsedURI(u) } -func (f *File) NormalizePath() error { - return f.Common.NormalizePath() -} - func (f *File) ContentType() string { var ext strings.Builder if f.parsedURI.Scheme != "file" { @@ -153,10 +149,6 @@ func (f *File) ContentType() string { return ext.String() } -func (f *File) SetResourceMapper(resources data.ResourceMapper) { - f.Resources = resources -} - func (f *File) Clone() data.Resource { return &File { Common: f.Common.Clone(), @@ -372,6 +364,15 @@ func (f *File) ResolveId(ctx context.Context) string { return f.Common.Path } +func (f *File) NormalizePath() error { + if f.config != nil { + if prefixPath, configErr := f.config.GetValue("prefix"); configErr == nil { + f.Common.Path = filepath.Join(prefixPath.(string), f.Common.Path) + } + } + return f.Common.NormalizePath() +} + /* func (f *File) NormalizePath() (err error) { if f.config != nil { @@ -595,11 +596,11 @@ func (f *File) ContentSourceRefStat() (info fs.FileInfo) { func (f *File) ReadStat() (err error) { var info fs.FileInfo - slog.Info("ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path) + slog.Info("File.ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path) info, err = f.Stat() - slog.Info("ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path, "info", info, "error", err) + slog.Info("File.ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path, "info", info, "error", err) if err == nil { _ = f.SetFileInfo(info) @@ -613,7 +614,7 @@ func (f *File) ReadStat() (err error) { } - slog.Info("ReadStat()", "stat", info, "path", f.Common.Path) + slog.Info("File.ReadStat()", "stat", info, "path", f.Common.Path) if err != nil { f.Common.State = "absent" return