mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
fix: 解决防盗链保存两次导致访问网站自动下载文件的问题 (#1489)
Refs https://github.com/1Panel-dev/1Panel/issues/1460
This commit is contained in:
parent
38bf54ec3b
commit
2ff7726442
@ -127,13 +127,27 @@ func (s *Server) RemoveDirective(key string, params []string) {
|
|||||||
var newDirectives []IDirective
|
var newDirectives []IDirective
|
||||||
for _, dir := range directives {
|
for _, dir := range directives {
|
||||||
if dir.GetName() == key {
|
if dir.GetName() == key {
|
||||||
if len(params) > 0 {
|
if len(params) == 0 {
|
||||||
oldParams := dir.GetParameters()
|
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] {
|
if oldParams[0] == params[0] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newDirectives = append(newDirectives, dir)
|
newDirectives = append(newDirectives, dir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user