aboutsummaryrefslogtreecommitdiff
path: root/object/id/object_format_parse.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-06 21:05:18 +0000
committerGravatar Runxi Yu2026-06-06 21:05:18 +0000
commitd0f52a812c32bd8227179322947e880a9a966a11 (patch)
treef483edb05d78109c9792252bd0bbbc1bee5769d2 /object/id/object_format_parse.go
parentobject/store: Go does not accept \0 (diff)
signatureNo signature
Various fixes and QoL things
Diffstat (limited to 'object/id/object_format_parse.go')
-rw-r--r--object/id/object_format_parse.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/object/id/object_format_parse.go b/object/id/object_format_parse.go
index 9e7401c7..521cbd89 100644
--- a/object/id/object_format_parse.go
+++ b/object/id/object_format_parse.go
@@ -1,8 +1,11 @@
package id
// ParseObjectFormat parses a canonical object format name (e.g. "sha1", "sha256").
-func ParseObjectFormat(s string) (ObjectFormat, bool) {
+func ParseObjectFormat(s string) (ObjectFormat, error) {
objectFormat, ok := objectFormatByName[s]
+ if !ok {
+ return ObjectFormatUnknown, ErrInvalidObjectFormat
+ }
- return objectFormat, ok
+ return objectFormat, nil
}