mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-15 00:01:25 -04:00
Compare commits
11 Commits
bb25f85ce8
...
0bd05a9f1c
Author | SHA1 | Date | |
---|---|---|---|
|
0bd05a9f1c | ||
|
ef9e0ce9c9 | ||
|
c0ddec8a2a | ||
|
bf77e2163b | ||
|
bc4e06109d | ||
|
bc784a705b | ||
|
3843252938 | ||
|
5bc9f7fcf9 | ||
|
a6450494c3 | ||
|
572af214a7 | ||
|
ad03c6e0a3 |
47
CHANGELOG.md
47
CHANGELOG.md
@ -4,6 +4,53 @@ This changelog goes through all the changes that have been made in each release
|
||||
without substantial changes to our git log; to see the highlights of what has
|
||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
|
||||
## [1.19.2](https://github.com/go-gitea/gitea/releases/tag/1.19.2) - 2023-04-26
|
||||
|
||||
* SECURITY
|
||||
* Require repo scope for PATs for private repos and basic authentication (#24362) (#24364)
|
||||
* Only delete secrets belonging to its owner (#24284) (#24286)
|
||||
* API
|
||||
* Fix typo in API route (#24310) (#24332)
|
||||
* Fix access token issue on some public endpoints (#24194) (#24259)
|
||||
* ENHANCEMENTS
|
||||
* Fix broken clone script on an empty archived repo (#24339) (#24348)
|
||||
* Fix Monaco IOS keyboard button (#24341) (#24347)
|
||||
* Don't set meta `theme-color` by default (#24340) (#24346)
|
||||
* Wrap too long push mirror addresses (#21120) (#24334)
|
||||
* Add --font-weight-bold and set previous bold to 601 (#24307) (#24331)
|
||||
* Unify nightly naming across binaries and docker images (#24116) (#24308)
|
||||
* Fix footer display (#24251) (#24269)
|
||||
* Fix label color, fix divider in dropdown (#24215) (#24244)
|
||||
* Vertical widths of containers removed (#24184) (#24211)
|
||||
* Use correct locale key for forks page (#24172) (#24175)
|
||||
* Sort repo topic labels by name (#24123) (#24153)
|
||||
* Highlight selected file in the PR file tree (#23947) (#24126)
|
||||
* BUGFIXES
|
||||
* Fix auth check bug (#24382) (#24387)
|
||||
* Add tags list for repos whose release setting is disabled (#23465) (#24369)
|
||||
* Fix wrong error info in RepoRefForAPI (#24344) (#24351)
|
||||
* Fix no edit/close/delete button in org repo project view page (#24349)
|
||||
* Respect the REGISTER_MANUAL_CONFIRM setting when registering via OIDC (#24035) (#24333)
|
||||
* Remove org users who belong to no teams (#24247) (#24313)
|
||||
* Fix bug when deleting wiki with no code write permission (#24274) (#24295)
|
||||
* Handle canceled workflow as a warning instead of a fail (#24282) (#24292)
|
||||
* Load reviewer for comments when dismissing a review (#24281) (#24288)
|
||||
* Show commit history for closed/merged PRs (#24238) (#24261)
|
||||
* Fix owner team access mode value in team_unit table (#24224)
|
||||
* Fix issue attachment handling (#24202) (#24221)
|
||||
* Fix incorrect CORS default values (#24206) (#24217)
|
||||
* Fix template error in pull request with deleted head repo (#24192) (#24216)
|
||||
* Don't list root repository on compare page if pulls not allowed (#24183) (#24210)
|
||||
* Fix calReleaseNumCommitsBehind (#24148) (#24197)
|
||||
* Fix Org edit page bugs: renaming detection, maxlength (#24161) (#24171)
|
||||
* Update redis library to support redis v7 (#24114) (#24156)
|
||||
* Use 1.18's aria role for dropdown menus (#24144) (#24155)
|
||||
* Fix 2-dot direct compare to use the right base commit (#24133) (#24150)
|
||||
* Fix incorrect server error content in RunnersList (#24118) (#24121)
|
||||
* Fix mismatch between hook events and github event types (#24048) (#24091)
|
||||
* BUILD
|
||||
* Support converting varchar to nvarchar for mssql database (#24105) (#24168)
|
||||
|
||||
## [1.19.1](https://github.com/go-gitea/gitea/releases/tag/v1.19.1) - 2023-04-12
|
||||
|
||||
* BREAKING
|
||||
|
@ -82,6 +82,11 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Ensure file has a final newline
|
||||
if jsonBytes[len(jsonBytes)-1] != '\n' {
|
||||
jsonBytes = append(jsonBytes, '\n')
|
||||
}
|
||||
|
||||
err = os.WriteFile(out, jsonBytes, 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
13
docs/layouts/alias.html
Normal file
13
docs/layouts/alias.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html{{ with site.LanguageCode | default site.Language.Lang }} lang="{{ . }}"{{ end }}>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ .Permalink }}</title>
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
<meta name="robots" content="noindex">
|
||||
<noscript><meta http-equiv="refresh" content="0; url={{ .Permalink }}"></noscript>
|
||||
<script>
|
||||
window.location = "{{ .Permalink }}" + window.location.search + window.location.hash;
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
@ -726,12 +726,9 @@ func GetRepositoriesMapByIDs(ids []int64) (map[int64]*Repository, error) {
|
||||
return repos, db.GetEngine(db.DefaultContext).In("id", ids).Find(&repos)
|
||||
}
|
||||
|
||||
// IsRepositoryExist returns true if the repository with given name under user has already existed.
|
||||
func IsRepositoryExist(ctx context.Context, u *user_model.User, repoName string) (bool, error) {
|
||||
has, err := db.GetEngine(ctx).Get(&Repository{
|
||||
OwnerID: u.ID,
|
||||
LowerName: strings.ToLower(repoName),
|
||||
})
|
||||
// IsRepositoryModelOrDirExist returns true if the repository with given name under user has already existed.
|
||||
func IsRepositoryModelOrDirExist(ctx context.Context, u *user_model.User, repoName string) (bool, error) {
|
||||
has, err := IsRepositoryModelExist(ctx, u, repoName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -739,6 +736,13 @@ func IsRepositoryExist(ctx context.Context, u *user_model.User, repoName string)
|
||||
return has || isDir, err
|
||||
}
|
||||
|
||||
func IsRepositoryModelExist(ctx context.Context, u *user_model.User, repoName string) (bool, error) {
|
||||
return db.GetEngine(ctx).Get(&Repository{
|
||||
OwnerID: u.ID,
|
||||
LowerName: strings.ToLower(repoName),
|
||||
})
|
||||
}
|
||||
|
||||
// GetTemplateRepo populates repo.TemplateRepo for a generated repository and
|
||||
// returns an error on failure (NOTE: no error is returned for
|
||||
// non-generated repositories, and TemplateRepo will be left untouched)
|
||||
|
@ -116,7 +116,7 @@ func CheckCreateRepository(doer, u *user_model.User, name string, overwriteOrAdo
|
||||
return err
|
||||
}
|
||||
|
||||
has, err := IsRepositoryExist(db.DefaultContext, u, name)
|
||||
has, err := IsRepositoryModelOrDirExist(db.DefaultContext, u, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("IsRepositoryExist: %w", err)
|
||||
} else if has {
|
||||
@ -147,7 +147,7 @@ func ChangeRepositoryName(doer *user_model.User, repo *Repository, newRepoName s
|
||||
return err
|
||||
}
|
||||
|
||||
has, err := IsRepositoryExist(db.DefaultContext, repo.Owner, newRepoName)
|
||||
has, err := IsRepositoryModelOrDirExist(db.DefaultContext, repo.Owner, newRepoName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("IsRepositoryExist: %w", err)
|
||||
} else if has {
|
||||
|
@ -172,7 +172,7 @@ func CreatePendingRepositoryTransfer(ctx context.Context, doer, newOwner *user_m
|
||||
}
|
||||
|
||||
// Check if new owner has repository with same name.
|
||||
if has, err := repo_model.IsRepositoryExist(ctx, newOwner, repo.Name); err != nil {
|
||||
if has, err := repo_model.IsRepositoryModelExist(ctx, newOwner, repo.Name); err != nil {
|
||||
return fmt.Errorf("IsRepositoryExist: %w", err)
|
||||
} else if has {
|
||||
return repo_model.ErrRepoAlreadyExist{
|
||||
@ -249,7 +249,7 @@ func TransferOwnership(doer *user_model.User, newOwnerName string, repo *repo_mo
|
||||
newOwnerName = newOwner.Name // ensure capitalisation matches
|
||||
|
||||
// Check if new owner has repository with same name.
|
||||
if has, err := repo_model.IsRepositoryExist(ctx, newOwner, repo.Name); err != nil {
|
||||
if has, err := repo_model.IsRepositoryModelOrDirExist(ctx, newOwner, repo.Name); err != nil {
|
||||
return fmt.Errorf("IsRepositoryExist: %w", err)
|
||||
} else if has {
|
||||
return repo_model.ErrRepoAlreadyExist{
|
||||
|
@ -35,7 +35,7 @@ func CreateRepositoryByExample(ctx context.Context, doer, u *user_model.User, re
|
||||
return err
|
||||
}
|
||||
|
||||
has, err := repo_model.IsRepositoryExist(ctx, u, repo.Name)
|
||||
has, err := repo_model.IsRepositoryModelExist(ctx, u, repo.Name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("IsRepositoryExist: %w", err)
|
||||
} else if has {
|
||||
|
@ -18,3 +18,7 @@ func (su *StringUtils) HasPrefix(s, prefix string) bool {
|
||||
func (su *StringUtils) Contains(s, substr string) bool {
|
||||
return strings.Contains(s, substr)
|
||||
}
|
||||
|
||||
func (su *StringUtils) Split(s, sep string) []string {
|
||||
return strings.Split(s, sep)
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/options"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/translation/i18n"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
"golang.org/x/text/message"
|
||||
@ -241,5 +242,12 @@ func (l *locale) TrN(cnt any, key1, keyN string, args ...any) string {
|
||||
|
||||
func (l *locale) PrettyNumber(v any) string {
|
||||
// TODO: this mechanism is not good enough, the complete solution is to switch the translation system to ICU message format
|
||||
if s, ok := v.(string); ok {
|
||||
if num, err := util.ToInt64(s); err == nil {
|
||||
v = num
|
||||
} else if num, err := util.ToFloat64(s); err == nil {
|
||||
v = num
|
||||
}
|
||||
}
|
||||
return l.msgPrinter.Sprintf("%v", number.Decimal(v))
|
||||
}
|
||||
|
@ -21,7 +21,12 @@ func TestPrettyNumber(t *testing.T) {
|
||||
|
||||
l := NewLocale("id-ID")
|
||||
assert.EqualValues(t, "1.000.000", l.PrettyNumber(1000000))
|
||||
assert.EqualValues(t, "1.000.000,1", l.PrettyNumber(1000000.1))
|
||||
assert.EqualValues(t, "1.000.000", l.PrettyNumber("1000000"))
|
||||
assert.EqualValues(t, "1.000.000", l.PrettyNumber("1000000.0"))
|
||||
assert.EqualValues(t, "1.000.000,1", l.PrettyNumber("1000000.1"))
|
||||
|
||||
l = NewLocale("nosuch")
|
||||
assert.EqualValues(t, "1,000,000", l.PrettyNumber(1000000))
|
||||
assert.EqualValues(t, "1,000,000.1", l.PrettyNumber(1000000.1))
|
||||
}
|
||||
|
@ -2380,7 +2380,7 @@ branch.already_exists = A branch named "%s" already exists.
|
||||
branch.delete_head = Delete
|
||||
branch.delete = Delete Branch "%s"
|
||||
branch.delete_html = Delete Branch
|
||||
branch.delete_desc = Deleting a branch is permanent. It <strong>CANNOT</strong> be undone. Continue?
|
||||
branch.delete_desc = Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
|
||||
branch.deletion_success = Branch "%s" has been deleted.
|
||||
branch.deletion_failed = Failed to delete branch "%s".
|
||||
branch.delete_branch_has_new_commits = Branch "%s" cannot be deleted because new commits have been added after merging.
|
||||
|
@ -61,7 +61,7 @@ new_project_column=创建列
|
||||
manage_org=管理我的组织
|
||||
admin_panel=管理后台
|
||||
account_settings=帐户设置
|
||||
settings=帐户设置
|
||||
settings=设置
|
||||
your_profile=个人信息
|
||||
your_starred=已点赞
|
||||
your_settings=设置
|
||||
|
@ -95,7 +95,7 @@ func AdoptRepository(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// check not a repo
|
||||
has, err := repo_model.IsRepositoryExist(ctx, ctxUser, repoName)
|
||||
has, err := repo_model.IsRepositoryModelExist(ctx, ctxUser, repoName)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
@ -157,7 +157,7 @@ func DeleteUnadoptedRepository(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// check not a repo
|
||||
has, err := repo_model.IsRepositoryExist(ctx, ctxUser, repoName)
|
||||
has, err := repo_model.IsRepositoryModelExist(ctx, ctxUser, repoName)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
|
@ -133,7 +133,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) {
|
||||
repoName := dirSplit[1]
|
||||
|
||||
// check not a repo
|
||||
has, err := repo_model.IsRepositoryExist(ctx, ctxUser, repoName)
|
||||
has, err := repo_model.IsRepositoryModelExist(ctx, ctxUser, repoName)
|
||||
if err != nil {
|
||||
ctx.ServerError("IsRepositoryExist", err)
|
||||
return
|
||||
|
@ -31,7 +31,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) {
|
||||
root := user_model.UserPath(ctxUser.LowerName)
|
||||
|
||||
// check not a repo
|
||||
has, err := repo_model.IsRepositoryExist(ctx, ctxUser, dir)
|
||||
has, err := repo_model.IsRepositoryModelExist(ctx, ctxUser, dir)
|
||||
if err != nil {
|
||||
ctx.ServerError("IsRepositoryExist", err)
|
||||
return
|
||||
|
@ -206,7 +206,7 @@ func DeleteUnadoptedRepository(ctx context.Context, doer, u *user_model.User, re
|
||||
}
|
||||
}
|
||||
|
||||
if exist, err := repo_model.IsRepositoryExist(ctx, u, repoName); err != nil {
|
||||
if exist, err := repo_model.IsRepositoryModelExist(ctx, u, repoName); err != nil {
|
||||
return err
|
||||
} else if exist {
|
||||
return repo_model.ErrRepoAlreadyExist{
|
||||
|
@ -71,7 +71,7 @@
|
||||
{{$userName}}
|
||||
{{end}}
|
||||
</span>
|
||||
<span class="time gt-df gt-ac">{{$commit.Date}}</span>
|
||||
<span class="time gt-df gt-ac">{{DateTime "full" $commit.Date}}</span>
|
||||
{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
|
@ -15,7 +15,9 @@
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="item">
|
||||
<span>{{svg "octicon-database"}} <b>{{FileSize .Repository.Size}}</b></span>
|
||||
{{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
|
||||
{{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}}
|
||||
<span>{{svg "octicon-database"}} <b>{{.locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@ -4,6 +4,7 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
@ -159,3 +160,30 @@ func testAPIGetContents(t *testing.T, u *url.URL) {
|
||||
req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/contents/%s?token=%s", user3.Name, repo3.Name, treePath, token2)
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
}
|
||||
|
||||
func TestAPIGetContentsRefFormats(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
file := "README.md"
|
||||
sha := "65f1bf27bc3bf70f64657658635e66094edbcb4d"
|
||||
content := "# repo1\n\nDescription for repo1"
|
||||
|
||||
noRef := setting.AppURL + "api/v1/repos/user2/repo1/raw/" + file
|
||||
refInPath := setting.AppURL + "api/v1/repos/user2/repo1/raw/" + sha + "/" + file
|
||||
refInQuery := setting.AppURL + "api/v1/repos/user2/repo1/raw/" + file + "?ref=" + sha
|
||||
|
||||
resp := MakeRequest(t, NewRequest(t, http.MethodGet, noRef), http.StatusOK)
|
||||
raw, err := io.ReadAll(resp.Body)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, content, string(raw))
|
||||
|
||||
resp = MakeRequest(t, NewRequest(t, http.MethodGet, refInPath), http.StatusOK)
|
||||
raw, err = io.ReadAll(resp.Body)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, content, string(raw))
|
||||
|
||||
resp = MakeRequest(t, NewRequest(t, http.MethodGet, refInQuery), http.StatusOK)
|
||||
raw, err = io.ReadAll(resp.Body)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, content, string(raw))
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user