[PR #3858] [MERGED] types/model: restrict digest hash part to a minimum of 2 characters #11299

Closed
opened 2026-04-12 23:27:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/3858
Author: @bmizerany
Created: 4/24/2024
Status: Merged
Merged: 4/24/2024
Merged by: @bmizerany

Base: mainHead: bmizerany/namehelpers


📝 Commits (1)

  • 7506f9a types/model: restrict digest hash part to a minimum of 2 characters

📊 Changes

3 files changed (+34 additions, -19 deletions)

View changed files

📝 types/model/digest.go (+13 -9)
📝 types/model/name.go (+12 -1)
📝 types/model/name_test.go (+9 -9)

📄 Description

This allows users of a valid Digest to know it has a minimum of 2 characters in the hash part for use when sharding.

This is a reasonable restriction as the hash part is a SHA256 hash which is 64 characters long, which is the common hash used. There is no anticipation of using a hash with less than 2 characters.

Also, add MustParseDigest.

Also, replace Digest.Type with Digest.Split for getting both the type and hash parts together, which is most the common case when asking for either.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/3858 **Author:** [@bmizerany](https://github.com/bmizerany) **Created:** 4/24/2024 **Status:** ✅ Merged **Merged:** 4/24/2024 **Merged by:** [@bmizerany](https://github.com/bmizerany) **Base:** `main` ← **Head:** `bmizerany/namehelpers` --- ### 📝 Commits (1) - [`7506f9a`](https://github.com/ollama/ollama/commit/7506f9a752799fcd5f5c91f78fb2f71302490a30) types/model: restrict digest hash part to a minimum of 2 characters ### 📊 Changes **3 files changed** (+34 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `types/model/digest.go` (+13 -9) 📝 `types/model/name.go` (+12 -1) 📝 `types/model/name_test.go` (+9 -9) </details> ### 📄 Description This allows users of a valid Digest to know it has a minimum of 2 characters in the hash part for use when sharding. This is a reasonable restriction as the hash part is a SHA256 hash which is 64 characters long, which is the common hash used. There is no anticipation of using a hash with less than 2 characters. Also, add MustParseDigest. Also, replace Digest.Type with Digest.Split for getting both the type and hash parts together, which is most the common case when asking for either. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:27:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#11299