diff options
author | a1012112796 <1012112796@qq.com> | 2021-04-15 17:04:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 12:04:25 +0300 |
commit | b28c3245cc1ccdc6ac76ed879c67bfd926678062 (patch) | |
tree | 2b74a1fa1db12cf3e3cbf0c403a53500a321eabc | |
parent | ddfb72916850cc81f0d208d690fd451c9ca31995 (diff) | |
download | gitea-b28c3245cc1ccdc6ac76ed879c67bfd926678062.tar.gz gitea-b28c3245cc1ccdc6ac76ed879c67bfd926678062.zip |
fix wrong file link in code search page (#15466) (#15486)
in previous the grenrated link is
``testg/testrepo/src/commit/....``
which is not right.
the right version is ``/testg/testrepo/.......``
(start wiht ``/``)
or ``http://127.0.0.1:3000/xxxxx`` (full link)
to make it hase same result with explore page
I choose the secound style.
fix #15438
Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
-rw-r--r-- | routers/repo/search.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/routers/repo/search.go b/routers/repo/search.go index 481b64d184..e23ebb9880 100644 --- a/routers/repo/search.go +++ b/routers/repo/search.go @@ -5,7 +5,6 @@ package repo import ( - "path" "strings" "code.gitea.io/gitea/modules/base" @@ -40,7 +39,7 @@ func Search(ctx *context.Context) { ctx.Data["Keyword"] = keyword ctx.Data["Language"] = language ctx.Data["queryType"] = queryType - ctx.Data["SourcePath"] = path.Join(setting.AppSubURL, ctx.Repo.Repository.Owner.Name, ctx.Repo.Repository.Name) + ctx.Data["SourcePath"] = ctx.Repo.Repository.HTMLURL() ctx.Data["SearchResults"] = searchResults ctx.Data["SearchResultLanguages"] = searchResultLanguages ctx.Data["RequireHighlightJS"] = true |