浏览代码

Prevent redirect to Host (#9678) (#9680)

tags/v1.10.3
zeripath 4 年前
父节点
当前提交
cd3e52d91b
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      modules/context/context.go

+ 2
- 1
modules/context/context.go 查看文件

@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

@@ -122,7 +123,7 @@ func (ctx *Context) RedirectToFirst(location ...string) {
}

u, err := url.Parse(loc)
if err != nil || (u.Scheme != "" && !strings.HasPrefix(strings.ToLower(loc), strings.ToLower(setting.AppURL))) {
if err != nil || ((u.Scheme != "" || u.Host != "") && !strings.HasPrefix(strings.ToLower(loc), strings.ToLower(setting.AppURL))) {
continue
}


正在加载...
取消
保存