Modify: return parent folder id while listing objects

This commit is contained in:
HFO4
2020-02-07 13:54:37 +08:00
parent 4c530a26a0
commit 16613a6113
13 changed files with 30 additions and 36 deletions

View File

@@ -67,6 +67,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL,
nil,
request.WithContext(ctx),
request.WithTimeout(time.Duration(0)),
).CheckHTTPResponse(200).GetRSCloser()
if err != nil {
return nil, err

View File

@@ -10,6 +10,7 @@ import (
"github.com/HFO4/cloudreve/pkg/serializer"
"io"
"net/url"
"time"
)
// Driver OneDrive 适配器
@@ -40,6 +41,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL,
nil,
request.WithContext(ctx),
request.WithTimeout(time.Duration(0)),
).CheckHTTPResponse(200).GetRSCloser()
if err != nil {
return nil, err

View File

@@ -99,6 +99,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL,
nil,
request.WithContext(ctx),
request.WithTimeout(time.Duration(0)),
).CheckHTTPResponse(200).GetRSCloser()
if err != nil {
return nil, err

View File

@@ -50,6 +50,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
request.WithHeader(
http.Header{"Cache-Control": {"no-cache", "no-store", "must-revalidate"}},
),
request.WithTimeout(time.Duration(0)),
).CheckHTTPResponse(200).GetRSCloser()
if err != nil {
return nil, err

View File

@@ -17,6 +17,7 @@ import (
"net/url"
"path"
"strings"
"time"
)
// Driver 远程存储策略适配器
@@ -70,6 +71,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL,
nil,
request.WithContext(ctx),
request.WithTimeout(time.Duration(0)),
).CheckHTTPResponse(200).GetRSCloser()
if err != nil {
return nil, err

View File

@@ -68,6 +68,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
request.WithHeader(
http.Header{"Cache-Control": {"no-cache", "no-store", "must-revalidate"}},
),
request.WithTimeout(time.Duration(0)),
).CheckHTTPResponse(200).GetRSCloser()
if err != nil {
return nil, err

View File

@@ -257,6 +257,7 @@ func (fs *FileSystem) List(ctx context.Context, dirPath string, pathProcessor fu
if !isExist {
return []Object{}, nil
}
fs.SetTargetDir(&[]model.Folder{*folder})
var parentPath = path.Join(folder.Position, folder.Name)
var childFolders []model.Folder

View File

@@ -44,6 +44,7 @@ type group struct {
AllowArchiveDownload bool `json:"allowArchiveDownload"`
ShareFreeEnabled bool `json:"shareFree"`
ShareDownload bool `json:"shareDownload"`
CompressEnabled bool `json:"compress"`
}
type storage struct {
@@ -54,7 +55,6 @@ type storage struct {
// BuildUser 序列化用户
func BuildUser(user model.User) User {
aria2Option := user.Group.GetAria2Option()
return User{
ID: user.ID,
Email: user.Email,
@@ -75,11 +75,11 @@ func BuildUser(user model.User) User {
ID: user.GroupID,
Name: user.Group.Name,
AllowShare: user.Group.ShareEnabled,
AllowRemoteDownload: aria2Option[0],
AllowTorrentDownload: aria2Option[2],
AllowRemoteDownload: user.Group.OptionsSerialized.Aria2,
AllowArchiveDownload: user.Group.OptionsSerialized.ArchiveDownload,
ShareFreeEnabled: user.Group.OptionsSerialized.ShareFree,
ShareDownload: user.Group.OptionsSerialized.ShareDownload,
CompressEnabled: user.Group.OptionsSerialized.ArchiveTask,
},
}
}