2022-06-23 23:03:11 +08:00
|
|
|
package fs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-08-03 14:26:59 +08:00
|
|
|
|
2022-06-23 23:03:11 +08:00
|
|
|
"github.com/alist-org/alist/v3/internal/model"
|
|
|
|
"github.com/alist-org/alist/v3/internal/operations"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
2022-06-28 21:58:46 +08:00
|
|
|
func link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error) {
|
2022-07-10 14:45:39 +08:00
|
|
|
storage, actualPath, err := operations.GetStorageAndActualPath(path)
|
2022-06-23 23:03:11 +08:00
|
|
|
if err != nil {
|
2022-07-10 14:45:39 +08:00
|
|
|
return nil, nil, errors.WithMessage(err, "failed get storage")
|
2022-06-23 23:03:11 +08:00
|
|
|
}
|
2022-07-10 14:45:39 +08:00
|
|
|
return operations.Link(ctx, storage, actualPath, args)
|
2022-06-23 23:03:11 +08:00
|
|
|
}
|