mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-21 22:18:23 +01:00
Fix bug
This commit is contained in:
parent
305795c6aa
commit
e9222e4f63
@ -150,7 +150,7 @@ type CreateRepoOption struct {
|
||||
DefaultBranch string `json:"default_branch" binding:"GitRefName;MaxSize(100)"`
|
||||
// TrustModel of the repository
|
||||
// enum: default,collaborator,committer,collaboratorcommitter
|
||||
TrustModel string `json:"trust_model" binding:"In(default,collaborator,committer,collaboratorcommitter)"`
|
||||
TrustModel string `json:"trust_model"`
|
||||
// ObjectFormatName of the underlying git repository, empty string for default (sha1)
|
||||
// enum: sha1,sha256
|
||||
ObjectFormatName string `json:"object_format_name" binding:"MaxSize(6)"`
|
||||
|
||||
@ -42,7 +42,7 @@ type CreateRepoForm struct {
|
||||
ProtectedBranch bool
|
||||
|
||||
ForkSingleBranch string `binding:"MaxSize(255)"`
|
||||
ObjectFormatName string `binding:"In(sha1,sha256)"`
|
||||
ObjectFormatName string
|
||||
}
|
||||
|
||||
// Validate validates the fields
|
||||
|
||||
@ -230,6 +230,9 @@ func CreateRepositoryDirectly(ctx context.Context, doer, owner *user_model.User,
|
||||
if opts.ObjectFormatName == "" {
|
||||
opts.ObjectFormatName = git.Sha1ObjectFormat.Name()
|
||||
}
|
||||
if opts.ObjectFormatName != git.Sha1ObjectFormat.Name() && opts.ObjectFormatName != git.Sha256ObjectFormat.Name() {
|
||||
return nil, fmt.Errorf("unsupported object format: %s", opts.ObjectFormatName)
|
||||
}
|
||||
|
||||
repo := &repo_model.Repository{
|
||||
OwnerID: owner.ID,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user