default to post

This commit is contained in:
Josh Yan 2024-07-23 14:05:48 -07:00
parent b29382b86f
commit 65658e4077
2 changed files with 7 additions and 14 deletions

View File

@ -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
}

View File

@ -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")
}