Skip to content

Commit

Permalink
chore(lark): don't use github.com/ipfs/boxo/path
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jul 14, 2024
1 parent 83048e6 commit fe1040a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 102 deletions.
19 changes: 10 additions & 9 deletions drivers/lark/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import (
"context"
"errors"
"fmt"
"io"
"net/http"
"strconv"
"strings"
"time"

"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/ipfs/boxo/path"
lark "github.com/larksuite/oapi-sdk-go/v3"
larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
larkdrive "github.com/larksuite/oapi-sdk-go/v3/service/drive/v1"
"golang.org/x/time/rate"
"io"
"net/http"
"strconv"
"time"
)

type Lark struct {
Expand All @@ -37,7 +38,7 @@ func (c *Lark) GetAddition() driver.Additional {
func (c *Lark) Init(ctx context.Context) error {
c.client = lark.NewClient(c.AppId, c.AppSecret, lark.WithTokenCache(newTokenCache()))

paths := path.SplitList(c.RootFolderPath)
paths := strings.Split(c.RootFolderPath, "/")
token := ""

var ok bool
Expand Down Expand Up @@ -113,7 +114,7 @@ func (c *Lark) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]

f := model.Object{
ID: *file.Token,
Path: path.Join([]string{c.RootFolderPath, dir.GetPath(), *file.Name}),
Path: strings.Join([]string{c.RootFolderPath, dir.GetPath(), *file.Name}, "/"),
Name: *file.Name,
Size: 0,
Modified: time.Unix(modifiedUnix, 0),
Expand Down Expand Up @@ -170,7 +171,7 @@ func (c *Lark) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*
},
}, nil
} else {
url := path.Join([]string{c.TenantUrlPrefix, "file", token})
url := strings.Join([]string{c.TenantUrlPrefix, "file", token}, "/")

return &model.Link{
URL: url,
Expand Down Expand Up @@ -201,7 +202,7 @@ func (c *Lark) MakeDir(ctx context.Context, parentDir model.Obj, dirName string)

return &model.Object{
ID: *resp.Data.Token,
Path: path.Join([]string{c.RootFolderPath, parentDir.GetPath(), dirName}),
Path: strings.Join([]string{c.RootFolderPath, parentDir.GetPath(), dirName}, "/"),
Name: dirName,
Size: 0,
IsFolder: true,
Expand Down
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/hirochachacha/go-smb2 v1.1.0
github.com/ipfs/boxo v0.12.0
github.com/ipfs/go-ipfs-api v0.7.0
github.com/jlaffaye/ftp v0.2.0
github.com/json-iterator/go v1.1.12
Expand Down Expand Up @@ -85,6 +84,7 @@ require (
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/ipfs/boxo v0.12.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
)

Expand Down Expand Up @@ -120,9 +120,6 @@ require (
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down Expand Up @@ -173,7 +170,6 @@ require (
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -183,7 +179,6 @@ require (
github.com/mschoch/smat v0.2.0 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
Expand Down
Loading

0 comments on commit fe1040a

Please sign in to comment.