fix(blogo,gitea): contents of root directory/repository not working

This commit is contained in:
Guz
2025-01-09 09:53:46 -03:00
parent 99435eada6
commit 2144b4bbaf

View File

@@ -62,7 +62,12 @@ func (fsys *repositoryFS) Open(name string) (fs.File, error) {
// If previous call returned a error, it may be because the file is a directory,
// so we will call from it's parent directory to be able to get it's metadata.
list, res, err := fsys.client.ListContents(fsys.owner, fsys.repo, fsys.ref, path.Dir(name))
path := path.Dir(name)
if path == "." {
path = ""
}
list, res, err := fsys.client.ListContents(fsys.owner, fsys.repo, fsys.ref, path)
if err != nil {
if res.StatusCode == http.StatusUnauthorized {
return nil, &fs.PathError{Op: "open", Path: name, Err: fs.ErrPermission}