feat: show
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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"`
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user