mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-10 17:13:30 +08:00
fix: 解决防盗链保存两次导致访问网站自动下载文件的问题 (#1489)
Refs https://github.com/1Panel-dev/1Panel/issues/1460
This commit is contained in:
parent
38bf54ec3b
commit
2ff7726442
1 changed files with 18 additions and 4 deletions
|
@ -127,13 +127,27 @@ func (s *Server) RemoveDirective(key string, params []string) {
|
|||
var newDirectives []IDirective
|
||||
for _, dir := range directives {
|
||||
if dir.GetName() == key {
|
||||
if len(params) > 0 {
|
||||
oldParams := dir.GetParameters()
|
||||
if len(params) == 0 {
|
||||
continue
|
||||
}
|
||||
oldParams := dir.GetParameters()
|
||||
if key == "location" {
|
||||
if len(params) == len(oldParams) {
|
||||
exist := true
|
||||
for i := range params {
|
||||
if params[i] != oldParams[i] {
|
||||
exist = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if exist {
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if oldParams[0] == params[0] {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
newDirectives = append(newDirectives, dir)
|
||||
|
|
Loading…
Reference in a new issue