fix: if we are being requested the root while is a dot, create a file based on the root cid with the . name

This commit is contained in:
Derrick Hammer 2024-03-03 07:38:34 -05:00
parent 9d378f4197
commit bd29ab4612
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 1 deletions

View File

@ -32,9 +32,17 @@ func (w webAppFs) Open(name string) (fs.File, error) {
return nil, errors.New("manifest is not a web app")
}
if name == "." {
return w.s5.newFile(FileParams{
Hash: w.root.Hash.HashBytes(),
Type: w.root.Type,
Name: name,
}), nil
}
item, ok := webApp.Paths.Get(name)
if !ok && name != "/" && name != "." {
if !ok {
return nil, fs.ErrNotExist
}
return w.s5.newFile(FileParams{