feat: show

This commit is contained in:
zhaoyupeng
2024-10-11 18:36:59 +08:00
parent f54ed67f0f
commit edfb7bee2e
6 changed files with 24 additions and 9 deletions

View File

@ -30,7 +30,7 @@ func Init(ctx context.Context) error {
register("/api/connection/connect", handler.ConnectionConnect)
register("/api/connection/disconnect", handler.ConnectionDisconnect)
register("/api/connection/buckets", handler.ConnectionBuckets)
register("/api/bucket/files", handler.BucketFile)
register("/api/bucket/files", handler.BucketFiles)
return nil
}

View File

@ -6,7 +6,7 @@ import (
"github.com/loveuer/nf-disk/ndh"
)
func BucketFile(c *ndh.Ctx) error {
func BucketFiles(c *ndh.Ctx) error {
type Req struct {
ConnId uint64 `json:"conn_id"`
Bucket string `json:"bucket"`

View File

@ -78,7 +78,7 @@ func (c *Client) ListFile(ctx context.Context, bucket string, prefix string) ([]
name := strings.TrimPrefix(*item.Prefix, prefix)
return &ListFileRes{
Name: name,
Key: name,
Key: *item.Prefix,
Type: ListFileTypeDir,
}, name != ""
},
@ -88,7 +88,7 @@ func (c *Client) ListFile(ctx context.Context, bucket string, prefix string) ([]
output.Contents,
func(item types.Object, index int) *ListFileRes {
return &ListFileRes{
Key: *item.Key,
Key: strings.Clone(*item.Key),
Name: strings.TrimPrefix(*item.Key, prefix),
LastModified: *item.LastModified,
Size: *item.Size,