MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / putDirectly

Function putDirectly

internal/fs/put.go:97–111  ·  view source on GitHub ↗

putDirect put the file and return after finish

(ctx context.Context, dstDirPath string, file model.FileStreamer, skipHook ...bool)

Source from the content-addressed store, hash-verified

95
96// putDirect put the file and return after finish
97func putDirectly(ctx context.Context, dstDirPath string, file model.FileStreamer, skipHook ...bool) error {
98 storage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
99 if err != nil {
100 _ = file.Close()
101 return errors.WithMessage(err, "failed get storage")
102 }
103 if storage.Config().NoUpload {
104 _ = file.Close()
105 return errors.WithStack(errs.UploadNotSupported)
106 }
107 if utils.IsBool(skipHook...) {
108 ctx = context.WithValue(ctx, conf.SkipHookKey, struct{}{})
109 }
110 return op.Put(ctx, storage, dstDirActualPath, file, nil)
111}
112
113func getDirectUploadInfo(ctx context.Context, tool, dstDirPath, dstName string, fileSize int64, overwrite bool) (any, error) {
114 storage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)

Callers 1

PutDirectlyFunction · 0.85

Calls 5

GetStorageAndActualPathFunction · 0.92
IsBoolFunction · 0.92
PutFunction · 0.92
CloseMethod · 0.65
ConfigMethod · 0.65

Tested by

no test coverage detected