mirror of
https://github.com/gogs/gogs.git
synced 2025-05-31 11:42:13 +00:00
explore: panic if search without login (#3088)
This commit is contained in:
parent
96ae0129ef
commit
e6df2259ab
@ -75,9 +75,13 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
|||||||
}
|
}
|
||||||
count = opts.Counter(opts.Private)
|
count = opts.Counter(opts.Private)
|
||||||
} else {
|
} else {
|
||||||
|
var ctxUserID int64
|
||||||
|
if ctx.IsSigned {
|
||||||
|
ctxUserID = ctx.User.ID
|
||||||
|
}
|
||||||
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
||||||
Keyword: keyword,
|
Keyword: keyword,
|
||||||
UserID: ctx.User.ID,
|
UserID: ctxUserID,
|
||||||
OrderBy: opts.OrderBy,
|
OrderBy: opts.OrderBy,
|
||||||
Private: opts.Private,
|
Private: opts.Private,
|
||||||
Page: page,
|
Page: page,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user