Skip to content

Commit d228c9a

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Move assign project when creating pull request to the same database transaction (go-gitea#36244) [skip ci] Updated translations via Crowdin Fix stats bug when syncing release (go-gitea#36285) Fix link/origin referrer and login redirect (go-gitea#36279) Always honor user's choice for "delete branch after merge" (go-gitea#36281) refactor(pprof): use explicit mux instead of DefaultServeMux (go-gitea#36276) improve the compare page (go-gitea#36261) mailer: pass request context to generateAdditionalHeadersForIssue (go-gitea#36274) feat(debian): use explicit, stronger defaults for newly generated repo signing keys (go-gitea#36236) Make "commit statuses" API accept slashes in "ref" (go-gitea#36264) # Conflicts: # templates/base/footer_content.tmpl # templates/base/head_navbar.tmpl
2 parents bd27cbc + 426bb49 commit d228c9a

71 files changed

Lines changed: 630 additions & 690 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/web.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ import (
88
"fmt"
99
"net"
1010
"net/http"
11+
"net/http/pprof"
1112
"os"
1213
"path/filepath"
1314
"strconv"
1415
"strings"
1516
"time"
1617

17-
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
18-
1918
"code.gitea.io/gitea/modules/container"
2019
"code.gitea.io/gitea/modules/graceful"
2120
"code.gitea.io/gitea/modules/gtprof"
@@ -234,12 +233,18 @@ func serveInstalled(c *cli.Command) error {
234233
}
235234

236235
func servePprof() {
237-
// FIXME: it shouldn't use the global DefaultServeMux, and it should use a proper context
238-
http.DefaultServeMux.Handle("/debug/fgprof", fgprof.Handler())
236+
mux := http.NewServeMux()
237+
mux.HandleFunc("/debug/pprof/", pprof.Index)
238+
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
239+
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
240+
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
241+
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
242+
mux.Handle("/debug/fgprof", fgprof.Handler())
243+
// FIXME: it should use a proper context
239244
_, _, finished := process.GetManager().AddTypedContext(context.TODO(), "Web: PProf Server", process.SystemProcessType, true)
240245
// The pprof server is for debug purpose only, it shouldn't be exposed on public network. At the moment, it's not worth introducing a configurable option for it.
241246
log.Info("Starting pprof server on localhost:6060")
242-
log.Info("Stopped pprof server: %v", http.ListenAndServe("localhost:6060", nil))
247+
log.Info("Stopped pprof server: %v", http.ListenAndServe("localhost:6060", mux))
243248
finished()
244249
}
245250

modules/git/ref.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,14 @@ func (ref RefName) RefWebLinkPath() string {
220220
}
221221
return string(refType) + "/" + util.PathEscapeSegments(ref.ShortName())
222222
}
223+
224+
func ParseRefSuffix(ref string) (string, string) {
225+
// Partially support https://git-scm.com/docs/gitrevisions
226+
if idx := strings.Index(ref, "@{"); idx != -1 {
227+
return ref[:idx], ref[idx:]
228+
}
229+
if idx := strings.Index(ref, "^"); idx != -1 {
230+
return ref[:idx], ref[idx:]
231+
}
232+
return ref, ""
233+
}

modules/markup/html_link.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ func createDescriptionLink(href, content string) *html.Node {
208208
Attr: []html.Attribute{
209209
{Key: "href", Val: href},
210210
{Key: "target", Val: "_blank"},
211-
{Key: "rel", Val: "noopener noreferrer"},
212211
},
213212
}
214213
textNode.Parent = linkNode

modules/markup/sanitizer_description_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestDescriptionSanitizer(t *testing.T) {
1616
`<span class="emoji" aria-label="thumbs up">THUMBS UP</span>`, `<span class="emoji" aria-label="thumbs up">THUMBS UP</span>`,
1717
`<span style="color: red">Hello World</span>`, `<span>Hello World</span>`,
1818
`<br>`, ``,
19-
`<a href="https://example.com" target="_blank" rel="noopener noreferrer">https://example.com</a>`, `<a href="https://example.com" target="_blank" rel="noopener noreferrer nofollow">https://example.com</a>`,
19+
`<a href="https://example.com" target="_blank">https://example.com</a>`, `<a href="https://example.com" target="_blank" rel="nofollow noopener">https://example.com</a>`,
2020
`<a href="data:1234">data</a>`, `data`,
2121
`<mark>Important!</mark>`, `Important!`,
2222
`<details>Click me! <summary>Nothing to see here.</summary></details>`, `Click me! Nothing to see here.`,

modules/repository/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func SyncReleasesWithTags(ctx context.Context, repo *repo_model.Repository, gitR
233233
return fmt.Errorf("unable to update tag %s for pull-mirror Repo[%d:%s/%s]: %w", tag.Name, repo.ID, repo.OwnerName, repo.Name, err)
234234
}
235235
}
236-
added, deleted, updated = len(deletes), len(updates), len(inserts)
236+
added, deleted, updated = len(inserts), len(deletes), len(updates)
237237
return nil
238238
})
239239
if err != nil {

modules/web/middleware/cookie.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,24 @@ import (
1414
"code.gitea.io/gitea/modules/util"
1515
)
1616

17+
const cookieRedirectTo = "redirect_to"
18+
19+
func GetRedirectToCookie(req *http.Request) string {
20+
return GetSiteCookie(req, cookieRedirectTo)
21+
}
22+
1723
// SetRedirectToCookie convenience function to set the RedirectTo cookie consistently
1824
func SetRedirectToCookie(resp http.ResponseWriter, value string) {
19-
SetSiteCookie(resp, "redirect_to", value, 0)
25+
SetSiteCookie(resp, cookieRedirectTo, value, 0)
2026
}
2127

2228
// DeleteRedirectToCookie convenience function to delete most cookies consistently
2329
func DeleteRedirectToCookie(resp http.ResponseWriter) {
24-
SetSiteCookie(resp, "redirect_to", "", -1)
30+
SetSiteCookie(resp, cookieRedirectTo, "", -1)
31+
}
32+
33+
func RedirectLinkUserLogin(req *http.Request) string {
34+
return setting.AppSubURL + "/user/login?redirect_to=" + url.QueryEscape(setting.AppSubURL+req.URL.RequestURI())
2535
}
2636

2737
// GetSiteCookie returns given cookie value from request header.

options/locale/locale_en-US.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,8 +1736,11 @@
17361736
"repo.issues.reference_link": "Reference: %s",
17371737
"repo.compare.compare_base": "base",
17381738
"repo.compare.compare_head": "compare",
1739+
"repo.compare.title": "Comparing changes",
1740+
"repo.compare.description": "Choose two branches or tags to see what’s changed or to start a new pull request.",
17391741
"repo.pulls.desc": "Enable pull requests and code reviews.",
17401742
"repo.pulls.new": "New Pull Request",
1743+
"repo.pulls.new.description": "Discuss and review the changes in this comparison with others.",
17411744
"repo.pulls.new.blocked_user": "Cannot create pull request because you are blocked by the repository owner.",
17421745
"repo.pulls.new.must_collaborator": "You must be a collaborator to create pull request.",
17431746
"repo.pulls.new.already_existed": "A pull request between these branches already exists",
@@ -1747,7 +1750,6 @@
17471750
"repo.pulls.allow_edits_from_maintainers": "Allow edits from maintainers",
17481751
"repo.pulls.allow_edits_from_maintainers_desc": "Users with write access to the base branch can also push to this branch",
17491752
"repo.pulls.allow_edits_from_maintainers_err": "Updating failed",
1750-
"repo.pulls.compare_changes_desc": "Select the branch to merge into and the branch to pull from.",
17511753
"repo.pulls.has_viewed_file": "Viewed",
17521754
"repo.pulls.has_changed_since_last_review": "Changed since your last review",
17531755
"repo.pulls.viewed_files_label": "%[1]d / %[2]d files viewed",

0 commit comments

Comments
 (0)