summaryrefslogtreecommitdiffstats
path: root/services/wiki
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-09-22 01:43:29 +0200
committerGitHub <noreply@github.com>2023-09-22 01:43:29 +0200
commit28f9b313bab420be8f42e546015312904311adba (patch)
treef3f09c6cef7bf96c7f390ba8e858cf80b0445581 /services/wiki
parentFix release URL in webhooks (#27182) (diff)
downloadforgejo-28f9b313bab420be8f42e546015312904311adba.tar.xz
forgejo-28f9b313bab420be8f42e546015312904311adba.zip
Updates to the API for archived repos (#27149)
Diffstat (limited to 'services/wiki')
-rw-r--r--services/wiki/wiki.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go
index c0183dd2b5..250b539080 100644
--- a/services/wiki/wiki.go
+++ b/services/wiki/wiki.go
@@ -79,6 +79,11 @@ func prepareGitPath(gitRepo *git.Repository, wikiPath WebPath) (bool, string, er
// updateWikiPage adds a new page or edits an existing page in repository wiki.
func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldWikiName, newWikiName WebPath, content, message string, isNew bool) (err error) {
+ err = repo.MustNotBeArchived()
+ if err != nil {
+ return err
+ }
+
if err = validateWebPath(newWikiName); err != nil {
return err
}
@@ -238,6 +243,11 @@ func EditWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.R
// DeleteWikiPage deletes a wiki page identified by its path.
func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, wikiName WebPath) (err error) {
+ err = repo.MustNotBeArchived()
+ if err != nil {
+ return err
+ }
+
wikiWorkingPool.CheckIn(fmt.Sprint(repo.ID))
defer wikiWorkingPool.CheckOut(fmt.Sprint(repo.ID))