working commit

This commit is contained in:
2026-02-07 14:10:54 +02:00
parent 90905ace89
commit cd274d614a
12 changed files with 124 additions and 276 deletions
+11 -11
View File
@@ -31,7 +31,7 @@ type FileExistsParams struct {
}
type FileExistsResult struct {
ContentType string
ContentLength string
ContentSize string
ContentDigest string
}
@@ -64,7 +64,7 @@ func (oper *Operator) FileExists(ctx context.Context, param *FileExistsParams) (
return code, res, err
}
res = &FileExistsResult{
ContentLength: strconv.FormatInt(fileDescr.Size, 10),
ContentSize: strconv.FormatInt(fileDescr.Size, 10),
ContentType: fileDescr.Type,
ContentDigest: fileDescr.Checksum,
}
@@ -73,10 +73,10 @@ func (oper *Operator) FileExists(ctx context.Context, param *FileExistsParams) (
// PutFile
type PutFileParams struct {
ContentType string
ContentLength string
Filepath string
Source io.ReadCloser
ContentType string
ContentSize string
Filepath string
Source io.ReadCloser
}
type PutFileResult struct{}
@@ -86,12 +86,12 @@ func (oper *Operator) PutFile(ctx context.Context, param *PutFileParams) (int, *
var err error
res := &PutFileResult{}
if param.ContentLength == "" {
if param.ContentSize == "" {
code := http.StatusLengthRequired
err = fmt.Errorf("Content-Length is empty")
err = fmt.Errorf("Required Content-Size header is empty")
return code, res, err
}
size, err := strconv.ParseInt(param.ContentLength, 10, 64)
size, err := strconv.ParseInt(param.ContentSize, 10, 64)
if err != nil {
code := http.StatusLengthRequired
return code, res, err
@@ -166,7 +166,7 @@ type GetFileParams struct {
}
type GetFileResult struct {
ContentType string
ContentLength string
ContentSize string
ContentDigest string
Source io.ReadCloser
}
@@ -200,7 +200,7 @@ func (oper *Operator) GetFile(ctx context.Context, param *GetFileParams) (int, *
return code, res, err
}
res = &GetFileResult{
ContentLength: strconv.FormatInt(fileDescr.Size, 10),
ContentSize: strconv.FormatInt(fileDescr.Size, 10),
ContentType: fileDescr.Type,
ContentDigest: fileDescr.Checksum,
Source: reader,