Compare commits

...

23 Commits

Author SHA1 Message Date
Lunny Xiao
53efbeadc1 bug fix for dump when data directoryis not exist (#1025) (#1100) 2017-03-16 09:23:12 +08:00
Lunny Xiao
3d1ff149a2 add back the default setting values and fix #739 (#1093) (#1098) 2017-03-02 08:26:21 +08:00
Thomas Boerger
e2c8d6fcb2 [1.0] Added 1.0.2 to changelog (#1000)
* Added 1.0.2 to changelog

* Raised version to 1.0.2
2017-02-21 22:39:30 +08:00
Bo-Yi Wu
1a5df9e822 Security: fix XSS attack on alert (#981) 2017-02-19 22:20:15 +08:00
Lunny Xiao
21dc5996a5 Security: fix XSS attack on milestone (#977) 2017-02-19 19:09:32 +08:00
Lunny Xiao
023a6604e2 Handle SetModel error, fixes one errcheck report (#257) (#957) 2017-02-19 10:11:59 +08:00
Lunny Xiao
9a5009a2cc fix docker link on install page (#964) (#972) 2017-02-19 10:11:40 +08:00
Lunny Xiao
3121a7a037 Remove the default console logger when it is not set in the configuration (#602) (#960)
* Remove the default console logger when it is not set in the configuration

* Added comment to new function (lint failure)

* update based on PR comments (code style)

* code style fix (thanks bkcsoft)

* check if logger exists based on the l.outputs (like in l.DelLogger) instead of adapter, otherwise panic when reinstalling gitea (since the output adapter still exist, without outputs)
2017-02-18 22:25:28 +08:00
Lunny Xiao
61cdc32496 fixed bugs on Wiki and resolved #667 (#674) (#958) 2017-02-16 19:32:39 +08:00
Lunny Xiao
5fcf218ed9 Add data directory excluding sessions to dump (#587) (#959) 2017-02-16 17:30:28 +08:00
Lunny Xiao
91836614cd Security: prevent XSS attach on wiki page (#955)
Reported by Miguel Ángel Jimeno.
2017-02-16 17:02:15 +08:00
Lunny Xiao
ab4eb0daf9 bug fixed for issue count (#882) 2017-02-09 18:36:01 +08:00
Thomas Boerger
155fb93b9b Added 1.0.1 to changelog (#595)
(cherry picked from commit 0ac40cc694)
2017-01-05 21:13:52 +08:00
Thomas Boerger
3a8c792303 Clone tags within drone for proper version generation (#591) (#593)
(cherry picked from commit 2d17d6bc16)
2017-01-05 19:34:59 +08:00
Lunny Xiao
807c64800c fix config session missing data row & resolved #517 (#578) 2017-01-05 08:49:49 +08:00
Lunny Xiao
6ddb2dcd57 change the default action when deleting a release to not delete tag (#579) 2017-01-05 08:49:43 +08:00
Lunny Xiao
729ab80065 resolved #517: fix admin ui data row missing (#580) 2017-01-05 08:49:32 +08:00
Lunny Xiao
a5ea9b4f30 fix installation page ssh domain unavilable (#506) 2017-01-04 14:40:44 +01:00
Lunny Xiao
8f08ccdb9f bug fixed for fork repos (#563) 2017-01-03 12:40:58 +08:00
Lunny Xiao
10d73d38e0 resolved #485: when migrate empty wiki repo, then ignore (#544) 2016-12-31 18:36:41 +08:00
Lunny Xiao
fbb424c61d fix 500 when delete orgnization and resolved #486 (#507) 2016-12-28 08:53:17 +08:00
Bwko
e8bac94d1f At the locales replaced 6 with MIN_PASSWORD_LENGTH (#501) 2016-12-27 18:44:49 +08:00
Matthias Loibl
99c6556ff3 Don't trim trailing whitespaces for markdown (#467) 2016-12-24 09:35:37 +08:00
47 changed files with 228 additions and 95 deletions

View File

@ -3,6 +3,10 @@ workspace:
path: src/code.gitea.io/gitea
pipeline:
clone:
image: plugins/git
tags: true
test:
image: webhippie/golang:edge
pull: true

View File

@ -1 +1 @@
eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9zcnYvYXBwCiAgcGF0aDogc3JjL2NvZGUuZ2l0ZWEuaW8vZ2l0ZWEKCnBpcGVsaW5lOgogIHRlc3Q6CiAgICBpbWFnZTogd2ViaGlwcGllL2dvbGFuZzplZGdlCiAgICBwdWxsOiB0cnVlCiAgICBlbnZpcm9ubWVudDoKICAgICAgQ0dPX0VOQUJMRUQ6IDEKICAgICAgVEFHUzogc3FsaXRlIGJpbmRhdGEKICAgICAgR09QQVRIOiAvc3J2L2FwcAogICAgY29tbWFuZHM6CiAgICAgIC0gYXBrIC1VIGFkZCBvcGVuc3NoLWNsaWVudAogICAgICAtIG1ha2UgY2xlYW4KICA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gogIGdpdGh1YjoKICAgIGltYWdlOiBwbHVnaW5zL2dpdGh1Yi1yZWxlYXNlCiAgICBmaWxlczoKICAgICAgLSBkaXN0L3JlbGVhc2UvKgogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgdGFnIF0KICAgICAgYnJhbmNoOiBbIHJlZnMvdGFncy8qIF0KCiAgZ2l0dGVyOgogICAgaW1hZ2U6IHBsdWdpbnMvZ2l0dGVyCgpzZXJ2aWNlczoKICBteXNxbDoKICAgIGltYWdlOiBteXNxbDo1LjcKICAgIGVudmlyb25tZW50OgogICAgICAtIE1ZU1FMX0RBVEFCQVNFPXRlc3QKICAgICAgLSBNWVNRTF9BTExPV19FTVBUWV9QQVNTV09SRD15ZXMKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQoKICBwZ3NxbDoKICAgIGltYWdlOiBwb3N0Z3Jlczo5LjUKICAgIGVudmlyb25tZW50OgogICAgICAtIFBPU1RHUkVTX0RCPXRlc3QKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQo.NGE3UiNBappXiPimJXv1DzgjT3k2hofGPsCPhw7KsSM

View File

@ -25,3 +25,6 @@ indent_size = 4
[Makefile]
indent_style = tab
[*.md]
trim_trailing_whitespace = false

View File

@ -1,5 +1,31 @@
# Changelog
## [1.0.2](https://github.com/go-gitea/gitea/releases/tag/v1.0.2) - 2017-02-21
* BUGFIXES
* Fixed issue counter [#882](https://github.com/go-gitea/gitea/pull/882)
* Fixed XSS vulnerability on wiki page [#955](https://github.com/go-gitea/gitea/pull/955)
* Add data dir without session to dump [#587](https://github.com/go-gitea/gitea/pull/587)
* Fixed wiki page renaming [#958](https://github.com/go-gitea/gitea/pull/958)
* Drop default console logger if not required [#960](https://github.com/go-gitea/gitea/pull/960)
* Fixed docker docs link on install page [#972](https://github.com/go-gitea/gitea/pull/972)
* Handle SetModel errors [#957](https://github.com/go-gitea/gitea/pull/957)
* Fixed XSS vulnerability on milestones [#977](https://github.com/go-gitea/gitea/pull/977)
* Fixed XSS vulnerability on alerts [#981](https://github.com/go-gitea/gitea/pull/981)
## [1.0.1](https://github.com/go-gitea/gitea/releases/tag/v1.0.1) - 2017-01-05
* BUGFIXES
* Fixed localized MIN_PASSWORD_LENGTH [#501](https://github.com/go-gitea/gitea/pull/501)
* Fixed 500 error on organization delete [#507](https://github.com/go-gitea/gitea/pull/507)
* Ignore empty wiki repo on migrate [#544](https://github.com/go-gitea/gitea/pull/544)
* Proper check access for forking [#563](https://github.com/go-gitea/gitea/pull/563)
* Fix SSH domain on installer [#506](https://github.com/go-gitea/gitea/pull/506)
* Fix missing data rows on admin UI [#580](https://github.com/go-gitea/gitea/pull/580)
* Do not delete tags with releases by default [#579](https://github.com/go-gitea/gitea/pull/579)
* Fix missing session config data on admin UI [#578](https://github.com/go-gitea/gitea/pull/578)
* Properly show the version within footer on the UI [#593](https://github.com/go-gitea/gitea/pull/593)
## [1.0.0](https://github.com/go-gitea/gitea/releases/tag/v1.0.0) - 2016-12-23
* BREAKING

View File

@ -74,7 +74,9 @@ func runCreateUser(c *cli.Context) error {
setting.NewContext()
models.LoadConfigs()
models.SetEngine()
if err := models.SetEngine(); err != nil {
return fmt.Errorf("models.SetEngine: %v", err)
}
if err := models.CreateUser(&models.User{
Name: c.String("name"),

View File

@ -11,11 +11,13 @@ import (
"log"
"os"
"path"
"path/filepath"
"time"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/setting"
"github.com/Unknwon/cae/zip"
"github.com/Unknwon/com"
"github.com/urfave/cli"
)
@ -49,6 +51,7 @@ func runDump(ctx *cli.Context) error {
setting.CustomConf = ctx.String("config")
}
setting.NewContext()
setting.NewServices() // cannot access session settings otherwise
models.LoadConfigs()
models.SetEngine()
@ -97,6 +100,22 @@ func runDump(ctx *cli.Context) error {
} else {
log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
}
if com.IsExist(setting.AppDataPath) {
log.Printf("Packing data directory...%s", setting.AppDataPath)
var sessionAbsPath string
if setting.SessionConfig.Provider == "file" {
if len(setting.SessionConfig.ProviderConfig) == 0 {
setting.SessionConfig.ProviderConfig = "data/sessions"
}
sessionAbsPath, _ = filepath.Abs(setting.SessionConfig.ProviderConfig)
}
if err := zipAddDirectoryExclude(z, "data", setting.AppDataPath, sessionAbsPath); err != nil {
log.Fatalf("Failed to include data directory: %v", err)
}
}
if err := z.AddDir("log", setting.LogRootPath); err != nil {
log.Fatalf("Fail to include log: %v", err)
}
@ -119,3 +138,40 @@ func runDump(ctx *cli.Context) error {
return nil
}
// zipAddDirectoryExclude zips absPath to specified zipPath inside z excluding excludeAbsPath
func zipAddDirectoryExclude(zip *zip.ZipArchive, zipPath, absPath string, excludeAbsPath string) error {
absPath, err := filepath.Abs(absPath)
if err != nil {
return err
}
dir, err := os.Open(absPath)
if err != nil {
return err
}
defer dir.Close()
zip.AddEmptyDir(zipPath)
files, err := dir.Readdir(0)
if err != nil {
return err
}
for _, file := range files {
currentAbsPath := path.Join(absPath, file.Name())
currentZipPath := path.Join(zipPath, file.Name())
if file.IsDir() {
if currentAbsPath != excludeAbsPath {
if err = zipAddDirectoryExclude(zip, currentZipPath, currentAbsPath, excludeAbsPath); err != nil {
return err
}
}
} else {
if err = zip.AddFile(currentZipPath, currentAbsPath); err != nil {
return err
}
}
}
return nil
}

View File

@ -18,7 +18,7 @@ import (
)
// Version holds the current Gitea version
var Version = "1.0.0+dev"
var Version = "1.0.2+dev"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())

View File

@ -1279,7 +1279,7 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64) {
countSession := func(isClosed, isPull bool, repoID int64) *xorm.Session {
sess := x.
Where("issue.repo_id = ?", isClosed).
Where("is_closed = ?", isClosed).
And("is_pull = ?", isPull).
And("repo_id = ?", repoID)

View File

@ -206,12 +206,9 @@ func Organizations(page, pageSize int) ([]*User, error) {
// DeleteOrganization completely and permanently deletes everything of organization.
func DeleteOrganization(org *User) (err error) {
if err := DeleteUser(org); err != nil {
return err
}
sess := x.NewSession()
defer sessionRelease(sess)
defer sess.Close()
if err = sess.Begin(); err != nil {
return err
}
@ -228,7 +225,11 @@ func DeleteOrganization(org *User) (err error) {
return fmt.Errorf("deleteUser: %v", err)
}
return sess.Commit()
if err = sess.Commit(); err != nil {
return err
}
return RewriteAllPublicKeys()
}
// ________ ____ ___

View File

@ -189,7 +189,7 @@ func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error) {
}
// DeleteReleaseByID deletes a release and corresponding Git tag by given ID.
func DeleteReleaseByID(id int64, u *User) error {
func DeleteReleaseByID(id int64, u *User, delTag bool) error {
rel, err := GetReleaseByID(id)
if err != nil {
return fmt.Errorf("GetReleaseByID: %v", err)
@ -207,11 +207,13 @@ func DeleteReleaseByID(id int64, u *User) error {
return fmt.Errorf("DeleteReleaseByID: permission denied")
}
_, stderr, err := process.ExecDir(-1, repo.RepoPath(),
fmt.Sprintf("DeleteReleaseByID (git tag -d): %d", rel.ID),
"git", "tag", "-d", rel.TagName)
if err != nil && !strings.Contains(stderr, "not found") {
return fmt.Errorf("git tag -d: %v - %s", err, stderr)
if delTag {
_, stderr, err := process.ExecDir(-1, repo.RepoPath(),
fmt.Sprintf("DeleteReleaseByID (git tag -d): %d", rel.ID),
"git", "tag", "-d", rel.TagName)
if err != nil && !strings.Contains(stderr, "not found") {
return fmt.Errorf("git tag -d: %v - %s", err, stderr)
}
}
if _, err = x.Id(rel.ID).Delete(new(Release)); err != nil {

View File

@ -691,7 +691,6 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) {
wikiRemotePath := wikiRemoteURL(opts.RemoteAddr)
if len(wikiRemotePath) > 0 {
if err := os.RemoveAll(wikiPath); err != nil {
return repo, fmt.Errorf("Fail to remove %s: %v", wikiPath, err)
}
@ -700,8 +699,12 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) {
Mirror: true,
Quiet: true,
Timeout: migrateTimeout,
Branch: "master",
}); err != nil {
log.Info("Clone wiki: %v", err)
log.Warn("Clone wiki: %v", err)
if err := os.RemoveAll(wikiPath); err != nil {
return repo, fmt.Errorf("Fail to remove %s: %v", wikiPath, err)
}
}
}

View File

@ -885,8 +885,10 @@ func deleteUser(e *xorm.Session, u *User) error {
}
avatarPath := u.CustomAvatarPath()
if err := os.Remove(avatarPath); err != nil {
return fmt.Errorf("Fail to remove %s: %v", avatarPath, err)
if com.IsExist(avatarPath) {
if err := os.Remove(avatarPath); err != nil {
return fmt.Errorf("Fail to remove %s: %v", avatarPath, err)
}
}
return nil

View File

@ -89,7 +89,7 @@ func discardLocalWikiChanges(localPath string) error {
}
// updateWikiPage adds new page to repository wiki.
func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, message string, isNew bool) (err error) {
func (repo *Repository) updateWikiPage(doer *User, oldWikiPath, wikiPath, content, message string, isNew bool) (err error) {
wikiWorkingPool.CheckIn(com.ToStr(repo.ID))
defer wikiWorkingPool.CheckOut(com.ToStr(repo.ID))
@ -104,8 +104,8 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
return fmt.Errorf("UpdateLocalWiki: %v", err)
}
title = ToWikiPageName(title)
filename := path.Join(localPath, title+".md")
title := ToWikiPageName(wikiPath)
filename := path.Join(localPath, wikiPath+".md")
// If not a new file, show perform update not create.
if isNew {
@ -113,7 +113,7 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
return ErrWikiAlreadyExist{filename}
}
} else {
file := path.Join(localPath, oldTitle+".md")
file := path.Join(localPath, oldWikiPath+".md")
if err := os.Remove(file); err != nil {
return fmt.Errorf("Fail to remove %s: %v", file, err)
@ -149,19 +149,19 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
return nil
}
// AddWikiPage adds a new wiki page with a given title.
func (repo *Repository) AddWikiPage(doer *User, title, content, message string) error {
return repo.updateWikiPage(doer, "", title, content, message, true)
// AddWikiPage adds a new wiki page with a given wikiPath.
func (repo *Repository) AddWikiPage(doer *User, wikiPath, content, message string) error {
return repo.updateWikiPage(doer, "", wikiPath, content, message, true)
}
// EditWikiPage updates a wiki page identified by its title,
// optionally also changing title.
func (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error {
return repo.updateWikiPage(doer, oldTitle, title, content, message, false)
// EditWikiPage updates a wiki page identified by its wikiPath,
// optionally also changing wikiPath.
func (repo *Repository) EditWikiPage(doer *User, oldWikiPath, wikiPath, content, message string) error {
return repo.updateWikiPage(doer, oldWikiPath, wikiPath, content, message, false)
}
// DeleteWikiPage deletes a wiki page identified by its title.
func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error) {
// DeleteWikiPage deletes a wiki page identified by its wikiPath.
func (repo *Repository) DeleteWikiPage(doer *User, wikiPath string) (err error) {
wikiWorkingPool.CheckIn(com.ToStr(repo.ID))
defer wikiWorkingPool.CheckOut(com.ToStr(repo.ID))
@ -172,13 +172,13 @@ func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error) {
return fmt.Errorf("UpdateLocalWiki: %v", err)
}
title = ToWikiPageName(title)
filename := path.Join(localPath, title+".md")
filename := path.Join(localPath, wikiPath+".md")
if err := os.Remove(filename); err != nil {
return fmt.Errorf("Fail to remove %s: %v", filename, err)
}
title := ToWikiPageName(wikiPath)
message := "Delete page '" + title + "'"
if err = git.AddChanges(localPath, true); err != nil {

View File

@ -39,6 +39,17 @@ func NewLogger(bufLen int64, mode, config string) {
}
}
// DelLogger removes loggers that are for the given mode
func DelLogger(mode string) error {
for _, l := range loggers {
if _, ok := l.outputs[mode]; ok {
return l.DelLogger(mode)
}
}
Trace("Log adapter %s not found, no need to delete", mode)
return nil
}
// NewGitLogger create a logger for git
// FIXME: use same log level as other loggers.
func NewGitLogger(logPath string) {

View File

@ -284,7 +284,9 @@ var (
RunAtStart bool
Schedule string
}{
Schedule: "@every 10m",
Enabled: true,
RunAtStart: false,
Schedule: "@every 10m",
},
RepoHealthCheck: struct {
Enabled bool
@ -293,15 +295,18 @@ var (
Timeout time.Duration
Args []string `delim:" "`
}{
Schedule: "@every 24h",
Timeout: 60 * time.Second,
Args: []string{},
Enabled: true,
RunAtStart: false,
Schedule: "@every 24h",
Timeout: 60 * time.Second,
Args: []string{},
},
CheckRepoStats: struct {
Enabled bool
RunAtStart bool
Schedule string
}{
Enabled: true,
RunAtStart: true,
Schedule: "@every 24h",
},
@ -765,6 +770,16 @@ func newLogService() {
LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
LogConfigs = make([]string, len(LogModes))
useConsole := false
for _, mode := range LogModes {
if mode == "console" {
useConsole = true
}
}
if !useConsole {
log.DelLogger("console")
}
for i, mode := range LogModes {
mode = strings.TrimSpace(mode)

View File

@ -15,6 +15,7 @@ import (
"strings"
"time"
"github.com/microcosm-cc/bluemonday"
"golang.org/x/net/html/charset"
"golang.org/x/text/transform"
"gopkg.in/editorconfig/editorconfig-core-go.v1"
@ -61,6 +62,7 @@ func NewFuncMap() []template.FuncMap {
},
"AvatarLink": base.AvatarLink,
"Safe": Safe,
"Sanitize": bluemonday.UGCPolicy().Sanitize,
"Str2html": Str2html,
"TimeSince": base.TimeSince,
"RawTimeSince": base.RawTimeSince,

View File

@ -161,7 +161,7 @@ send_reset_mail=Щракнете тук, за да получите (отнов
reset_password=Нулиране на паролата
invalid_code=За съжаление Вашия код за потвърждение е изтекъл или е невалиден.
reset_password_helper=Щракнете тук, за да нулирате паролата си
password_too_short=Размерът на паролата не може да бъде по-малък от 6 знака.
password_too_short=Размерът на паролата не може да бъде по-малък от %d знака.
non_local_account=Нелокални потребители не могат да сменят паролата си през Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Klikněte zde pro znovuposlání e-mailu pro změnu vašeho hesl
reset_password=Obnova vašeho hesla
invalid_code=Omlouváme se, ale kód potvrzení vašeho účtu vypršel nebo není správný.
reset_password_helper=Klikněte zde pro obnovu vašeho hesla
password_too_short=Délka hesla musí být minimálně 6 znaků.
password_too_short=Délka hesla musí být minimálně %d znaků.
non_local_account=Externí účty nemohou měnit hesla přes Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Hier klicken, um die E-Mail zum Passwort-zurücksetzen erneut zu
reset_password=Passwort zurücksetzen
invalid_code=Es tut uns leid, der Bestätigungscode ist abgelaufen oder ungültig.
reset_password_helper=Hier klicken, um das Passwort zurückzusetzen
password_too_short=Das Passwort muss mindenstens 6 Zeichen lang sein.
password_too_short=Das Passwort muss mindenstens %d Zeichen lang sein.
non_local_account=Nicht-lokale Konten können Passwörter nicht via Gitea ändern.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Haga clic aquí para (re)enviar el correo para el restablecimien
reset_password=Restablecer su contraseña
invalid_code=Lo sentimos, su código de confirmación ha expirado o no es valido.
reset_password_helper=Haga Clic aquí para restablecer su contraseña
password_too_short=La longitud de la contraseña no puede ser menor a 6.
password_too_short=La longitud de la contraseña no puede ser menor a %d.
non_local_account=Cuentas que no son locales no pueden cambiar las contraseñas a través de Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Klikkaa tästä (uudelleen)lähettääksesi salasanan nollaus s
reset_password=Nollaa salasanasi
invalid_code=Sori, varmistuskoodisi on vanhentunut tai väärä.
reset_password_helper=Klikkaa tästä nollataksesi salasanasi
password_too_short=Salasanan pituus ei voi olla vähemmän kuin 6 merkkiä.
password_too_short=Salasanan pituus ei voi olla vähemmän kuin %d merkkiä.
non_local_account=Non-local accounts cannot change passwords through Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Cliquez ici pour (r)envoyer le mail de réinitialisation du mot
reset_password=Réinitialiser le mot de passe
invalid_code=Désolé, votre code de confirmation est invalide ou a expiré.
reset_password_helper=Cliquez ici pour réinitialiser votre mot de passe
password_too_short=Le mot de passe doit contenir 6 caractères minimum.
password_too_short=Le mot de passe doit contenir %d caractères minimum.
non_local_account=Les comptes non locaux ne peuvent pas changer leur mot de passe via Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Clicca qui per (ri)inviare la tua e-mail di reimpostazione passw
reset_password=Reimposta la tua Password
invalid_code=Siamo spiacenti, il codice di conferma è scaduto o non valido.
reset_password_helper=Clicca qui per reimpostare la password
password_too_short=La lunghezza della password non può essere meno 6 caratteri.
password_too_short=La lunghezza della password non può essere meno %d caratteri.
non_local_account=Gli account non locali non possono modificare le password tramite Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=パスワードリセットのメールを再送するにはこ
reset_password=パスワードリセット
invalid_code=申し訳ありませんが、確認用コードが期限切れまたは無効です。
reset_password_helper=パスワードをリセットするにはここをクリック
password_too_short=文字未満のパスワードは設定できません。
password_too_short=%d文字未満のパスワードは設定できません。
non_local_account=Non-local accounts cannot change passwords through Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=여기를 눌러 비밀번호 초기화 메일을 (재)전송
reset_password=비밀번호 초기화
invalid_code=죄송합니다. 확인 코드가 만료되었거나 유효하지 않습니다.
reset_password_helper=이곳을 눌러 비밀번호를 재설정
password_too_short=비밀번호의 길이는 6글자 미만일 수 없습니다.
password_too_short=비밀번호의 길이는 %d글자 미만일 수 없습니다.
non_local_account=Gitea 계정이 아니면 암호를 변경할 수 없습니다.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Spiediet šeit, lai nosūtītu paroles maiņas vēstuli uz Jūsu
reset_password=Atjaunot savu paroli
invalid_code=Atvainojiet, Jūsu apstiprināšanas kodam ir beidzies derīguma termiņš vai arī tas ir nepareizs.
reset_password_helper=Nospiediet šeit, lai atjaunotu paroli
password_too_short=Paroles garums nedrīkst būt mazāks par 6.
password_too_short=Paroles garums nedrīkst būt mazāks par %d.
non_local_account=Tikai lokālie konti var nomainīt savu paroli Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Klik hier om uw wachtwoord reset mail (nogmaals) te versturen
reset_password=Reset uw wachtwoord
invalid_code=Sorry, uw bevestigingscode is verlopen of niet meer geldig.
reset_password_helper=Klik hier om uw wachtwoord opnieuw in te stellen.
password_too_short=De lengte van uw wachtwoord moet minimaal zes karakters zijn.
password_too_short=De lengte van uw wachtwoord moet minimaal %d karakters zijn.
non_local_account=Non-local accounts cannot change passwords through Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Kliknij tutaj, aby (ponownie) wysłać e-mail z instrukcjami res
reset_password=Resetowanie hasła
invalid_code=Niestety, Twój kod potwierdzający wygasł lub jest nieprawidłowy.
reset_password_helper=Kliknij tutaj, aby zresetować hasło
password_too_short=Długość hasła nie może być mniejsza niż 6 znaków.
password_too_short=Długość hasła nie może być mniejsza niż %d znaków.
non_local_account=Nie lokalne konta nie mogą zmieniać haseł przez Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Clique aqui para (re)enviar seu e-mail de redefinição da senha
reset_password=Redefinir sua senha
invalid_code=Desculpe, seu código de confirmação expirou ou não é válido.
reset_password_helper=Clique aqui para redefinir sua senha
password_too_short=O comprimento da senha não pode ser menor que 6.
password_too_short=O comprimento da senha não pode ser menor que %d.
non_local_account=Não é possível mudar a senha de contas remotas pelo Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Нажмите сюда, чтобы отправить пись
reset_password=Сброс пароля
invalid_code=Извините, ваш код подтверждения истек или не является допустимым.
reset_password_helper=Нажмите здесь, чтобы сбросить свой пароль
password_too_short=Длина пароля не менее 6 символов.
password_too_short=Длина пароля не менее %d символов.
non_local_account=Нелокальные аккаунты не могут изменить пароль через Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Кликните овде да (поново) пошаљете
reset_password=Ресет лозинке
invalid_code=Извините, ваш код за потврду је истекао или није валидан.
reset_password_helper=Кликните овде да ресетујете вашу лозинку
password_too_short=Лозинка неможе бити краћа од 6 карактера.
password_too_short=Лозинка неможе бити краћа од %d карактера.
non_local_account=Нелокални налози не могу да промените лозинку преко Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Klicka här för att skicka e-post med lösenordsåterställning
reset_password=Återställ ditt lösenord
invalid_code=Tyvärr, din bekräftelsekod har antingen upphört att gälla eller är ogiltig.
reset_password_helper=Klicka här för att återställa ditt lösenord
password_too_short=Lösenordet får ej vara kortare än 6 tecken.
password_too_short=Lösenordet får ej vara kortare än %d tecken.
non_local_account=Icke-lokala konton får inte ändra lösenord genom Gogs.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=Parola sıfırlama e-postasını (yeniden) göndermek için bura
reset_password=Parolanızı Sıfırlayın
invalid_code=Üzgünüz, doğrulama kodunuz geçersiz veya süresi dolmuş.
reset_password_helper=Parolanızı sıfırlamak için buraya tıklayın
password_too_short=Parola uzunluğu 6 karakterden az olamaz.
password_too_short=Parola uzunluğu %d karakterden az olamaz.
non_local_account=Yerel olmayan hesapların şifrelerini Gitea aracılığıyla değiştiremezsiniz.
[mail]

View File

@ -165,7 +165,7 @@ send_reset_mail=单击此处(重新)发送您的密码重置邮件
reset_password=重置密码
invalid_code=对不起,您的确认代码已过期或已失效。
reset_password_helper=单击此处重置密码
password_too_short=密码长度不能少于 6 位!
password_too_short=密码长度不能少于 %d 位!
non_local_account=非本地类型的帐户无法通过 Gitea 修改密码。
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=單擊此處(重新)發送您的密碼重置郵件
reset_password=重置密碼
invalid_code=對不起,您的確認代碼已過期或已失效。
reset_password_helper=單擊此處重置密碼
password_too_short=密碼長度不能少於 6 位!
password_too_short=密碼長度不能少於 %d 位!
non_local_account=Non-local accounts cannot change passwords through Gitea.
[mail]

View File

@ -161,7 +161,7 @@ send_reset_mail=單擊此處(重新)發送您的密碼重置郵件
reset_password=重置密碼
invalid_code=對不起,您的確認代碼已過期或已失效。
reset_password_helper=單擊此處重置密碼
password_too_short=密碼長度不能少於 6 位!
password_too_short=密碼長度不能少於 %d 位!
non_local_account=非本地帳戶無法通過 Gitea 修改密碼。
[mail]

View File

@ -241,7 +241,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
cfg.Section("").Key("APP_NAME").SetValue(form.AppName)
cfg.Section("repository").Key("ROOT").SetValue(form.RepoRootPath)
cfg.Section("").Key("RUN_USER").SetValue(form.RunUser)
cfg.Section("server").Key("DOMAIN").SetValue(form.Domain)
cfg.Section("server").Key("SSH_DOMAIN").SetValue(form.Domain)
cfg.Section("server").Key("HTTP_PORT").SetValue(form.HTTPPort)
cfg.Section("server").Key("ROOT_URL").SetValue(form.AppURL)

View File

@ -48,7 +48,7 @@ func getForkRepository(ctx *context.Context) *models.Repository {
return nil
}
if !forkRepo.CanBeForked() {
if !forkRepo.CanBeForked() || !forkRepo.HasAccess(ctx.User) {
ctx.Handle(404, "getForkRepository", nil)
return nil
}

View File

@ -296,7 +296,8 @@ func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
// DeleteRelease delete a release
func DeleteRelease(ctx *context.Context) {
if err := models.DeleteReleaseByID(ctx.QueryInt64("id"), ctx.User); err != nil {
delTag := ctx.QueryBool("delTag")
if err := models.DeleteReleaseByID(ctx.QueryInt64("id"), ctx.User, delTag); err != nil {
ctx.Flash.Error("DeleteReleaseByID: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("repo.release.deletion_success"))

View File

@ -89,7 +89,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, str
ctx.Data["title"] = pageName
ctx.Data["RequireHighlightJS"] = true
blob, err := commit.GetBlobByPath(pageName + ".md")
blob, err := commit.GetBlobByPath(pageURL + ".md")
if err != nil {
if git.IsErrNotExist(err) {
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/_pages")
@ -114,7 +114,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, str
ctx.Data["content"] = string(data)
}
return wikiRepo, pageName
return wikiRepo, pageURL
}
// Wiki render wiki page
@ -127,13 +127,13 @@ func Wiki(ctx *context.Context) {
return
}
wikiRepo, pageName := renderWikiPage(ctx, true)
wikiRepo, pagePath := renderWikiPage(ctx, true)
if ctx.Written() {
return
}
// Get last change information.
lastCommit, err := wikiRepo.GetCommitByPath(pageName + ".md")
lastCommit, err := wikiRepo.GetCommitByPath(pagePath + ".md")
if err != nil {
ctx.Handle(500, "GetCommitByPath", err)
return
@ -214,7 +214,9 @@ func NewWikiPost(ctx *context.Context, form auth.NewWikiForm) {
return
}
if err := ctx.Repo.Repository.AddWikiPage(ctx.User, form.Title, form.Content, form.Message); err != nil {
wikiPath := models.ToWikiPageURL(form.Title)
if err := ctx.Repo.Repository.AddWikiPage(ctx.User, wikiPath, form.Content, form.Message); err != nil {
if models.IsErrWikiAlreadyExist(err) {
ctx.Data["Err_Title"] = true
ctx.RenderWithErr(ctx.Tr("repo.wiki.page_already_exists"), tplWikiNew, &form)
@ -224,7 +226,7 @@ func NewWikiPost(ctx *context.Context, form auth.NewWikiForm) {
return
}
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title))
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + wikiPath)
}
// EditWiki render wiki modify page
@ -257,12 +259,15 @@ func EditWikiPost(ctx *context.Context, form auth.NewWikiForm) {
return
}
if err := ctx.Repo.Repository.EditWikiPage(ctx.User, form.OldTitle, form.Title, form.Content, form.Message); err != nil {
oldWikiPath := ctx.Params(":page")
newWikiPath := models.ToWikiPageURL(form.Title)
if err := ctx.Repo.Repository.EditWikiPage(ctx.User, oldWikiPath, newWikiPath, form.Content, form.Message); err != nil {
ctx.Handle(500, "EditWikiPage", err)
return
}
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title))
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + newWikiPath)
}
// DeleteWikiPagePost delete wiki page
@ -272,8 +277,7 @@ func DeleteWikiPagePost(ctx *context.Context) {
pageURL = "Home"
}
pageName := models.ToWikiPageName(pageURL)
if err := ctx.Repo.Repository.DeleteWikiPage(ctx.User, pageName); err != nil {
if err := ctx.Repo.Repository.DeleteWikiPage(ctx.User, pageURL); err != nil {
ctx.Handle(500, "DeleteWikiPage", err)
return
}

View File

@ -88,15 +88,15 @@
<dt>{{.i18n.Tr "admin.config.db_type"}}</dt>
<dd>{{.DbCfg.Type}}</dd>
<dt>{{.i18n.Tr "admin.config.db_host"}}</dt>
<dd>{{.DbCfg.Host}}</dd>
<dd>{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_name"}}</dt>
<dd>{{.DbCfg.Name}}</dd>
<dd>{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_user"}}</dt>
<dd>{{.DbCfg.User}}</dd>
<dd>{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_ssl_mode"}}</dt>
<dd>{{.DbCfg.SSLMode}} {{.i18n.Tr "admin.config.db_ssl_mode_helper"}}</dd>
<dd><i class="fa fa{{if .DbCfg.SSLMode}}-check{{end}}-square-o"></i> {{.i18n.Tr "admin.config.db_ssl_mode_helper"}}</dd>
<dt>{{.i18n.Tr "admin.config.db_path"}}</dt>
<dd>{{.DbCfg.Path}} {{.i18n.Tr "admin.config.db_path_helper"}}</dd>
<dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}} {{.i18n.Tr "admin.config.db_path_helper"}}</dd>
</dl>
</div>
@ -194,7 +194,7 @@
<dt>{{.i18n.Tr "admin.config.session_provider"}}</dt>
<dd>{{.SessionConfig.Provider}}</dd>
<dt>{{.i18n.Tr "admin.config.provider_config"}}</dt>
<dd><code>{{.SessionConfig.ProviderConfig}}</code></dd>
<dd><code>{{if .SessionConfig.ProviderConfig}}{{.SessionConfig.ProviderConfig}}{{else}}-{{end}}</code></dd>
<dt>{{.i18n.Tr "admin.config.cookie_name"}}</dt>
<dd>{{.SessionConfig.CookieName}}</dd>
<dt>{{.i18n.Tr "admin.config.gc_interval_time"}}</dt>

View File

@ -1,15 +1,15 @@
{{if .Flash.ErrorMsg}}
<div class="ui negative message">
<p>{{.Flash.ErrorMsg | Safe}}</p>
<p>{{.Flash.ErrorMsg | Str2html}}</p>
</div>
{{end}}
{{if .Flash.SuccessMsg}}
<div class="ui positive message">
<p>{{.Flash.SuccessMsg | Safe}}</p>
<p>{{.Flash.SuccessMsg | Str2html}}</p>
</div>
{{end}}
{{if .Flash.InfoMsg}}
<div class="ui info message">
<p>{{.Flash.InfoMsg | Safe}}</p>
<p>{{.Flash.InfoMsg | Str2html}}</p>
</div>
{{end}}

View File

@ -8,7 +8,7 @@
<div class="ui attached segment">
{{template "base/alert" .}}
<p>{{.i18n.Tr "install.docker_helper" "https://github.com/go-gitea/gitea/tree/master/docker" | Safe}}</p>
<p>{{.i18n.Tr "install.docker_helper" "https://docs.gitea.io/en-us/install-with-docker/" | Safe}}</p>
<form class="ui form" action="{{AppSubUrl}}/install" method="post">
<!-- Dtabase Settings -->

View File

@ -33,7 +33,7 @@
<div class="menu">
<a class="item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
{{range .Labels}}
<a class="item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
<a class="item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | Sanitize}}</a>
{{end}}
</div>
</div>
@ -47,7 +47,7 @@
<div class="menu">
<a class="item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_milestone_no_select"}}</a>
{{range .Milestones}}
<a class="{{if eq $.MilestoneID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&assignee={{$.AssigneeID}}">{{.Name}}</a>
<a class="{{if eq $.MilestoneID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&assignee={{$.AssigneeID}}">{{.Name | Sanitize}}</a>
{{end}}
</div>
</div>
@ -105,7 +105,7 @@
<a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>
{{range .Labels}}
<a class="ui label" href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
<a class="ui label" href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name | Sanitize}}</a>
{{end}}
{{if .NumComments}}
@ -116,7 +116,7 @@
{{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}}
{{if .Milestone}}
<a class="milestone" href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.Milestone.ID}}&assignee={{$.AssigneeID}}">
<span class="octicon octicon-milestone"></span> {{.Milestone.Name}}
<span class="octicon octicon-milestone"></span> {{.Milestone.Name | Sanitize}}
</a>
{{end}}
{{if .Assignee}}

View File

@ -26,7 +26,7 @@
<div class="milestone list">
{{range .Milestones}}
<li class="item">
<i class="octicon octicon-milestone"></i> <a href="{{$.RepoLink}}/issues?state={{$.State}}&milestone={{.ID}}">{{.Name}}</a>
<i class="octicon octicon-milestone"></i> <a href="{{$.RepoLink}}/issues?state={{$.State}}&milestone={{.ID}}">{{.Name | Sanitize}}</a>
<div class="ui right green progress" data-percent="{{.Completeness}}">
<div class="bar" {{if not .Completeness}}style="background-color: transparent"{{end}}>
<div class="progress"></div>

View File

@ -263,7 +263,7 @@
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
{{range .Labels}}
<div class="item">
<a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
<a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name | Sanitize}}</a>
</div>
{{end}}
@ -285,7 +285,7 @@
{{.i18n.Tr "repo.issues.new.open_milestone"}}
</div>
{{range .OpenMilestones}}
<div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
<div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name | Sanitize}}</div>
{{end}}
{{end}}
{{if .ClosedMilestones}}
@ -295,7 +295,7 @@
{{.i18n.Tr "repo.issues.new.closed_milestone"}}
</div>
{{range .ClosedMilestones}}
<a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
<a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name | Sanitize}}</a>
{{end}}
{{end}}
</div>
@ -304,7 +304,7 @@
<span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
<div class="selected">
{{if .Issue.Milestone}}
<a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
<a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name | Sanitize}}</a>
{{end}}
</div>
</div>

View File

@ -1,6 +1,7 @@
{{template "base/head" .}}
<div class="repository wiki view">
{{template "repo/header" .}}
{{ $title := .title | Sanitize}}
<div class="ui container">
<div class="ui grid">
<div class="ui ten wide column">
@ -9,7 +10,7 @@
<div class="ui basic small button">
<span class="text">
{{.i18n.Tr "repo.wiki.page"}}:
<strong>{{.title}}</strong>
<strong>{{$title}}</strong>
</span>
<i class="dropdown icon"></i>
</div>
@ -20,7 +21,7 @@
</div>
<div class="scrolling menu">
{{range .Pages}}
<div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</div>
<div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name | Sanitize}}</div>
{{end}}
</div>
</div>
@ -51,7 +52,7 @@
</div>
</div>
<div class="ui dividing header">
{{.title}}
{{$title}}
{{if and .IsRepositoryWriter (not .Repository.IsMirror)}}
<div class="ui right">
<a class="ui small button" href="{{.RepoLink}}/wiki/{{EscapePound .PageURL}}/_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a>
@ -76,7 +77,7 @@
{{.i18n.Tr "repo.wiki.delete_page_button"}}
</div>
<div class="content">
<p>{{.i18n.Tr "repo.wiki.delete_page_notice_1" .title | Safe}}</p>
<p>{{.i18n.Tr "repo.wiki.delete_page_notice_1" $title | Safe}}</p>
</div>
{{template "base/delete_modal_actions" .}}
</div>