default to post
This commit is contained in:
parent
b29382b86f
commit
65658e4077
@ -5,7 +5,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -307,15 +306,9 @@ func CreateBlob(ctx context.Context, src, digest string, r *os.File) (error) {
|
||||
Host: net.JoinHostPort(ollamaHost.Host, ollamaHost.Port),
|
||||
}
|
||||
|
||||
data, err := json.Marshal(digest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
reqBody := bytes.NewReader(data)
|
||||
path := fmt.Sprintf("/api/blobs/%s", digest)
|
||||
requestURL := base.JoinPath(path)
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, requestURL.String(), reqBody)
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, requestURL.String(), r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -943,13 +943,13 @@ func (s *Server) CreateBlobHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
/* if c.GetHeader("X-Ollama-File") != "" && s.isLocal(c) {
|
||||
if c.GetHeader("X-Ollama-File") != "" && s.isLocal(c) {
|
||||
err = localBlobCopy(c.GetHeader("X-Ollama-File"), path)
|
||||
if err == nil {
|
||||
c.Status(http.StatusCreated)
|
||||
return
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
layer, err := NewLayer(c.Request.Body, "")
|
||||
if err != nil {
|
||||
@ -971,15 +971,15 @@ func localBlobCopy (src, dest string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
/* err = localCopy(src, dest)
|
||||
err = localCopy(src, dest)
|
||||
if err == nil {
|
||||
return nil
|
||||
} */
|
||||
}
|
||||
|
||||
/* err = defaultCopy(src, dest)
|
||||
err = defaultCopy(src, dest)
|
||||
if err == nil {
|
||||
return nil
|
||||
} */
|
||||
}
|
||||
|
||||
return fmt.Errorf("failed to copy blob")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user