Feat: list objects in specific path

This commit is contained in:
HFO4
2019-11-24 13:06:15 +08:00
parent a89c3cb11a
commit b431f3674c
8 changed files with 144 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/HFO4/cloudreve/models"
"github.com/HFO4/cloudreve/pkg/filesystem/local"
"github.com/gin-gonic/gin"
testMock "github.com/stretchr/testify/mock"
"io"
)
@@ -73,3 +74,11 @@ func NewFileSystem(user *model.User) (*FileSystem, error) {
Handler: handler,
}, nil
}
// NewFileSystemFromContext 从gin.Context创建文件系统
// TODO:test
func NewFileSystemFromContext(c *gin.Context) (*FileSystem, error) {
user, _ := c.Get("user")
fs, err := NewFileSystem(user.(*model.User))
return fs, err
}