diff --git a/server/images.go b/server/images.go index c1fab221..bec89f6d 100644 --- a/server/images.go +++ b/server/images.go @@ -854,6 +854,10 @@ func downloadBlob(mp ModelPath, digest string, username, password string, fn fun }) if completed >= total { + if err := out.Close(); err != nil { + return err + } + if err := os.Rename(fp+"-partial", fp); err != nil { fn(api.ProgressResponse{ Status: fmt.Sprintf("error renaming file: %v", err), diff --git a/server/modelpath.go b/server/modelpath.go index 26d2101a..02a955f6 100644 --- a/server/modelpath.go +++ b/server/modelpath.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strings" ) @@ -106,6 +107,10 @@ func GetBlobsPath(digest string) (string, error) { return "", err } + if runtime.GOOS == "windows" { + digest = strings.ReplaceAll(digest, ":", "-") + } + path := filepath.Join(home, ".ollama", "models", "blobs", digest) if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { return "", err