Browse Source

zones: fix New() to handle relative paths on hackpadfs

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head v0.4.3
Alejandro Mery 1 year ago
parent
commit
2207e4a4a4
  1. 8
      pkg/zones/zones.go

8
pkg/zones/zones.go

@ -3,6 +3,7 @@ package zones
import (
"io/fs"
"path/filepath"
"github.com/hack-pad/hackpadfs/os"
@ -105,7 +106,12 @@ func NewFS(dir fs.FS, domain string) (*Zones, error) {
// New builds a [Zones] tree using the given directory
func New(dir, domain string) (*Zones, error) {
base, err := os.NewFS().Sub(dir)
dir, err := filepath.Abs(dir)
if err != nil {
return nil, err
}
base, err := os.NewFS().Sub(dir[1:])
if err != nil {
return nil, err
}

Loading…
Cancel
Save