浏览代码

create the blobs directory correctly (#508)

Patrick Devine 1 年之前
父节点
当前提交
45ac07cd02
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      server/modelpath.go

+ 6 - 1
server/modelpath.go

@@ -133,7 +133,12 @@ func GetBlobsPath(digest string) (string, error) {
 	}
 
 	path := filepath.Join(home, ".ollama", "models", "blobs", digest)
-	if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
+	dirPath := filepath.Dir(path)
+	if digest == "" {
+		dirPath = path
+	}
+
+	if err := os.MkdirAll(dirPath, 0o755); err != nil {
 		return "", err
 	}