diff options
author | zeripath <art27@cantab.net> | 2022-09-04 11:47:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 13:47:56 +0300 |
commit | e6b3be460840f1f982d5358198466e7d6f509d21 (patch) | |
tree | d3e4cb52c6a7df321e9b4ffdfe6f99f79d392b63 /models/activities/action.go | |
parent | 93a610a819688b54d4565b8cbbae7cc04c552073 (diff) | |
download | gitea-e6b3be460840f1f982d5358198466e7d6f509d21.tar.gz gitea-e6b3be460840f1f982d5358198466e7d6f509d21.zip |
Add more checks in migration code (#21011)
When migrating add several more important sanity checks:
* SHAs must be SHAs
* Refs must be valid Refs
* URLs must be reasonable
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'models/activities/action.go')
-rw-r--r-- | models/activities/action.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/models/activities/action.go b/models/activities/action.go index 22419e20db..31ecdedd5b 100644 --- a/models/activities/action.go +++ b/models/activities/action.go @@ -267,7 +267,7 @@ func (a *Action) GetRefLink() string { return a.GetRepoLink() + "/src/branch/" + util.PathEscapeSegments(strings.TrimPrefix(a.RefName, git.BranchPrefix)) case strings.HasPrefix(a.RefName, git.TagPrefix): return a.GetRepoLink() + "/src/tag/" + util.PathEscapeSegments(strings.TrimPrefix(a.RefName, git.TagPrefix)) - case len(a.RefName) == 40 && git.SHAPattern.MatchString(a.RefName): + case len(a.RefName) == 40 && git.IsValidSHAPattern(a.RefName): return a.GetRepoLink() + "/src/commit/" + a.RefName default: // FIXME: we will just assume it's a branch - this was the old way - at some point we may want to enforce that there is always a ref here. |