clean up some log messages
This commit is contained in:
parent
7bc66cae90
commit
baa8e51b3e
@ -27,6 +27,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"embed"
|
"embed"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -99,7 +100,6 @@ type File struct {
|
|||||||
FileType FileType `json:"filetype" yaml:"filetype"`
|
FileType FileType `json:"filetype" yaml:"filetype"`
|
||||||
SerializeContent bool `json:"serializecontent,omitempty" yaml:"serializecontent,omitempty"`
|
SerializeContent bool `json:"serializecontent,omitempty" yaml:"serializecontent,omitempty"`
|
||||||
GzipContent bool `json:"gzipcontent,omitempty" yaml:"gzipcontent,omitempty"`
|
GzipContent bool `json:"gzipcontent,omitempty" yaml:"gzipcontent,omitempty"`
|
||||||
Resources data.ResourceMapper `json:"-" yaml:"-"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceFileInfo struct {
|
type ResourceFileInfo struct {
|
||||||
@ -135,10 +135,6 @@ func (f *File) Init(u data.URIParser) error {
|
|||||||
return f.SetParsedURI(u)
|
return f.SetParsedURI(u)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) NormalizePath() error {
|
|
||||||
return f.Common.NormalizePath()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *File) ContentType() string {
|
func (f *File) ContentType() string {
|
||||||
var ext strings.Builder
|
var ext strings.Builder
|
||||||
if f.parsedURI.Scheme != "file" {
|
if f.parsedURI.Scheme != "file" {
|
||||||
@ -153,10 +149,6 @@ func (f *File) ContentType() string {
|
|||||||
return ext.String()
|
return ext.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) SetResourceMapper(resources data.ResourceMapper) {
|
|
||||||
f.Resources = resources
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *File) Clone() data.Resource {
|
func (f *File) Clone() data.Resource {
|
||||||
return &File {
|
return &File {
|
||||||
Common: f.Common.Clone(),
|
Common: f.Common.Clone(),
|
||||||
@ -372,6 +364,15 @@ func (f *File) ResolveId(ctx context.Context) string {
|
|||||||
return f.Common.Path
|
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) {
|
func (f *File) NormalizePath() (err error) {
|
||||||
if f.config != nil {
|
if f.config != nil {
|
||||||
@ -595,11 +596,11 @@ func (f *File) ContentSourceRefStat() (info fs.FileInfo) {
|
|||||||
|
|
||||||
func (f *File) ReadStat() (err error) {
|
func (f *File) ReadStat() (err error) {
|
||||||
var info fs.FileInfo
|
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()
|
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 {
|
if err == nil {
|
||||||
_ = f.SetFileInfo(info)
|
_ = 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 {
|
if err != nil {
|
||||||
f.Common.State = "absent"
|
f.Common.State = "absent"
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user