mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Updates to the API for archived repos (#27149)
This commit is contained in:
@@ -47,6 +47,14 @@ func (err ErrUserDoesNotHaveAccessToRepo) Unwrap() error {
|
||||
return util.ErrPermissionDenied
|
||||
}
|
||||
|
||||
type ErrRepoIsArchived struct {
|
||||
Repo *Repository
|
||||
}
|
||||
|
||||
func (err ErrRepoIsArchived) Error() string {
|
||||
return fmt.Sprintf("%s is archived", err.Repo.LogString())
|
||||
}
|
||||
|
||||
var (
|
||||
reservedRepoNames = []string{".", "..", "-"}
|
||||
reservedRepoPatterns = []string{"*.git", "*.wiki", "*.rss", "*.atom"}
|
||||
@@ -654,6 +662,14 @@ func (repo *Repository) GetTrustModel() TrustModelType {
|
||||
return trustModel
|
||||
}
|
||||
|
||||
// MustNotBeArchived returns ErrRepoIsArchived if the repo is archived
|
||||
func (repo *Repository) MustNotBeArchived() error {
|
||||
if repo.IsArchived {
|
||||
return ErrRepoIsArchived{Repo: repo}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// __________ .__ __
|
||||
// \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
|
||||
// | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
|
||||
|
Reference in New Issue
Block a user