Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
0408205c
Unverified
Commit
0408205c
authored
Apr 18, 2024
by
Blake Mizerany
Committed by
GitHub
Apr 18, 2024
Browse files
types/model: accept former `:` as a separator in digest (#3724)
This also converges the old sep `:` to the new sep `-`.
parent
63a7edd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
types/model/digest.go
types/model/digest.go
+5
-1
No files found.
types/model/digest.go
View file @
0408205c
package
model
package
model
import
(
import
(
"fmt"
"log/slog"
"log/slog"
"strings"
"strings"
"unicode"
"unicode"
...
@@ -47,8 +48,11 @@ var (
...
@@ -47,8 +48,11 @@ var (
// Digest.
// Digest.
func
ParseDigest
(
s
string
)
Digest
{
func
ParseDigest
(
s
string
)
Digest
{
typ
,
digest
,
ok
:=
strings
.
Cut
(
s
,
"-"
)
typ
,
digest
,
ok
:=
strings
.
Cut
(
s
,
"-"
)
if
!
ok
{
typ
,
digest
,
ok
=
strings
.
Cut
(
s
,
":"
)
}
if
ok
&&
isValidDigestType
(
typ
)
&&
isValidHex
(
digest
)
{
if
ok
&&
isValidDigestType
(
typ
)
&&
isValidHex
(
digest
)
{
return
Digest
{
s
:
s
}
return
Digest
{
s
:
fmt
.
Sprintf
(
"%s-%s"
,
typ
,
digest
)
}
}
}
return
Digest
{}
return
Digest
{}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment