Compare commits

..

1 Commits

Author SHA1 Message Date
amery 2207e4a4a4 zones: fix New() to handle relative paths on hackpadfs
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-25 16:02:00 +00:00
+7 -1
View File
@@ -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
}