Explorar el Código

Added anti noobs design for -root paths in file manager list root function

TC pushbot 5 hace 4 años
padre
commit
ee0af4ed57
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      file_system.go

+ 2 - 2
file_system.go

@@ -1766,8 +1766,8 @@ func system_fs_listRoot(w http.ResponseWriter, r *http.Request) {
 			IsDir    bool
 		}
 		//List the root media folders under user:/
-		var filesInUserRoot []fileObject
-		filesInRoot, _ := filepath.Glob(*root_directory + "users/" + username + "/*")
+		filesInUserRoot := []fileObject{}
+		filesInRoot, _ := filepath.Glob(filepath.ToSlash(filepath.Clean(*root_directory)) + "/users/" + username + "/*")
 		for _, file := range filesInRoot {
 			thisFile := new(fileObject)
 			thisFile.Filename = filepath.Base(file)