Files
Gogs/internal/lfsutil/oid.go
ᴊᴏᴇ ᴄʜᴇɴ 59e9fa191b chore: remove all MIT license file headers (#8083)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2026-01-08 19:32:15 -05:00

22 lines
489 B
Go

package lfsutil
import (
"github.com/pkg/errors"
"gogs.io/gogs/internal/lazyregexp"
)
// OID is an LFS object ID.
type OID string
// An OID is a 64-char lower case hexadecimal, produced by SHA256.
// Spec: https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md
var oidRe = lazyregexp.New("^[a-f0-9]{64}$")
var ErrInvalidOID = errors.New("OID is not valid")
// ValidOID returns true if given oid is valid.
func ValidOID(oid OID) bool {
return oidRe.MatchString(string(oid))
}