mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-20 09:32:43 +09:00
Check commit message hashes before making links
Previously, when formatting commit messages, anything that looked like SHA1 hashes was turned into a link using regex. This meant that certain phrases or numbers such as `777777` or `deadbeef` could be recognized as a commit even if the repository has no commit with those hashes. This change will make it so that anything that looks like a SHA1 hash using regex will then also be checked to ensure that there is a commit in the repository with that hash before making a link. Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
@@ -508,8 +508,9 @@ func (repo *Repository) mustOwnerName(e Engine) string {
|
||||
func (repo *Repository) ComposeMetas() map[string]string {
|
||||
if repo.ExternalMetas == nil {
|
||||
repo.ExternalMetas = map[string]string{
|
||||
"user": repo.MustOwner().Name,
|
||||
"repo": repo.Name,
|
||||
"user": repo.MustOwner().Name,
|
||||
"repo": repo.Name,
|
||||
"repoPath": repo.RepoPath(),
|
||||
}
|
||||
unit, err := repo.GetUnit(UnitTypeExternalTracker)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user