fix: add special case to check for an index.html, and pass root and root type
This commit is contained in:
parent
bd5544198e
commit
080fcbd559
|
@ -3,6 +3,7 @@ package s5
|
|||
import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"path"
|
||||
|
||||
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
||||
"git.lumeweb.com/LumeWeb/libs5-go/metadata"
|
||||
|
@ -42,9 +43,21 @@ func (w webAppFs) Open(name string) (fs.File, error) {
|
|||
|
||||
item, ok := webApp.Paths.Get(name)
|
||||
|
||||
if !ok {
|
||||
name = path.Join(name, "index.html")
|
||||
item, ok = webApp.Paths.Get(name)
|
||||
if !ok {
|
||||
return nil, fs.ErrNotExist
|
||||
}
|
||||
|
||||
return w.s5.newFile(FileParams{
|
||||
Hash: item.Cid.Hash.HashBytes(),
|
||||
Type: item.Cid.Type,
|
||||
Name: name,
|
||||
Root: w.root.Hash.HashBytes(),
|
||||
RootType: w.root.Type,
|
||||
}), nil
|
||||
}
|
||||
return w.s5.newFile(FileParams{
|
||||
Hash: item.Cid.Hash.HashBytes(),
|
||||
Type: item.Cid.Type,
|
||||
|
|
Loading…
Reference in New Issue