mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2025-04-19 14:13:24 +00:00
解决沉浸式翻译使用 /v1/translate端点时传入多余cookie导致dl_session错误设置的问题
This commit is contained in:
parent
c678e87631
commit
e3d291e001
10
main.go
10
main.go
@ -176,9 +176,13 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
cookie := c.GetHeader("Cookie")
|
||||
if cookie != "" {
|
||||
dlSession = strings.Replace(cookie, "dl_session=", "", -1)
|
||||
if cookie := c.GetHeader("Cookie"); cookie != "" {
|
||||
for _, part := range strings.Split(cookie, ";") {
|
||||
if strings.HasPrefix(part, "dl_session=") {
|
||||
dlSession = strings.TrimPrefix(part, "dl_session=")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if dlSession == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user