forked from forgejo/forgejo
Backport #25235 by @lunny Fix #22109 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
d686aa0d31
commit
031ddfcb7b
3 changed files with 71 additions and 0 deletions
|
@ -28,6 +28,14 @@ func IsValidSHAPattern(sha string) bool {
|
|||
return shaPattern.MatchString(sha)
|
||||
}
|
||||
|
||||
type ErrInvalidSHA struct {
|
||||
SHA string
|
||||
}
|
||||
|
||||
func (err ErrInvalidSHA) Error() string {
|
||||
return fmt.Sprintf("invalid sha: %s", err.SHA)
|
||||
}
|
||||
|
||||
// MustID always creates a new SHA1 from a [20]byte array with no validation of input.
|
||||
func MustID(b []byte) SHA1 {
|
||||
var id SHA1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue