From 630a88714486243b6c5ec8f9ea168391f9aec04a Mon Sep 17 00:00:00 2001
From: shammash <shammash@autistici.org>
Date: Sun, 8 Mar 2015 14:21:38 -0400
Subject: [PATCH] workaround for stat on root dir

Signed-off-by: shammash <shammash@autistici.org>
---
 api/fsapi/by_artist.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/api/fsapi/by_artist.go b/api/fsapi/by_artist.go
index 7519d1e..8547266 100644
--- a/api/fsapi/by_artist.go
+++ b/api/fsapi/by_artist.go
@@ -48,8 +48,12 @@ func (afs *ByArtistFilesystem) Stat(path string) (Attr, error) {
 	if len(p) == 3 {
 		return afs.getSong(p[0], p[1], p[2])
 	} else if len(p) < 3 {
+		name := "/"
+		if len(p) > 0 {
+			name = p[len(p)-1]
+		}
 		attr := Attr{
-			Name:  p[len(p)-1],
+			Name:  name,
 			IsDir: true,
 		}
 		return attr, nil
-- 
GitLab