FIXED:
* tplx/sprigx would throw errors on dnsx.IsPtr, because it returns a
  bool and net.IP instead of a boolen and optional error. Fixed by
  adding dnsx.IsPtrChk and using that instead.
This commit is contained in:
brent saner
2026-08-08 00:13:34 -04:00
parent cbfaaddf34
commit 4e7d474fb3
12 changed files with 202 additions and 78 deletions
@@ -0,0 +1,52 @@
package main
import (
"io/fs"
"os"
"path/filepath"
"strings"
"r00t2.io/sysutils/paths"
)
// Open opens file fnm.
func (r *realFsMember) Open(fnm string) (fh fs.File, err error) {
if fh, err = r.Root.Open(fnm); err != nil {
return
}
return
}
// ReadDir returns directory entries at fpath joined with the realFsMember's root.
func (r *realFsMember) ReadDir(fpath string) (entries []fs.DirEntry, err error) {
var rel string
var fsp string = fpath
if !filepath.IsAbs(fsp) {
fsp = filepath.Join(
r.Root.Name(),
filepath.FromSlash(fsp),
)
}
if err = paths.RealPath(&fsp); err != nil {
return
}
if rel, err = filepath.Rel(r.Root.Name(), fsp); err != nil {
// Not relative to this root, so skip.
err = nil
return
}
if strings.HasPrefix(rel, "..") {
// Absolute but not relative to this root, so skip.
return
}
if entries, err = os.ReadDir(fsp); err != nil {
return
}
return
}