From 2144b4bbaf33fd78306bbadc4fca7bfaed2eee1d Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Thu, 9 Jan 2025 09:53:46 -0300 Subject: [PATCH] fix(blogo,gitea): contents of root directory/repository not working --- blogo/gitea/fs.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/blogo/gitea/fs.go b/blogo/gitea/fs.go index 7011867..f35a7e7 100644 --- a/blogo/gitea/fs.go +++ b/blogo/gitea/fs.go @@ -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}