Browse Source

fix: 解决网站路径重定向不保留URL参数不生效的问题 (#1855)

pull/1861/head
zhengkunwang 1 year ago committed by GitHub
parent
commit
07d5c580a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      backend/app/service/website.go
  2. 2
      frontend/src/views/website/website/config/basic/redirect/index.vue

4
backend/app/service/website.go

@ -2042,6 +2042,8 @@ func (w WebsiteService) OperateRedirect(req request.NginxRedirectReq) (err error
case "path":
if req.KeepPath {
target = req.Target + "$1"
} else {
target = req.Target + "?"
}
redirectKey := "permanent"
if req.Redirect == "302" {
@ -2210,7 +2212,7 @@ func (w WebsiteService) GetRedirect(id uint) (res []response.NginxRedirectConfig
redirectConfig.Target = strings.TrimSuffix(params[1], "$1")
} else {
redirectConfig.KeepPath = false
redirectConfig.Target = params[1]
redirectConfig.Target = strings.TrimSuffix(params[1], "?")
}
if params[2] == "permanent" {
redirectConfig.Redirect = "301"

2
frontend/src/views/website/website/config/basic/redirect/index.vue

@ -38,7 +38,7 @@
</el-table-column>
<fu-table-operations
:ellipsis="10"
width="260px"
width="220px"
:buttons="buttons"
:label="$t('commons.table.operate')"
:fixed="mobile ? false : 'right'"

Loading…
Cancel
Save