Browse Source

fix: 反向代理的文本替换不兼容 " 符号的问题 (#3647)

pull/3652/head
zhengkunwang 10 months ago committed by GitHub
parent
commit
fce0ac2c7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      backend/utils/nginx/parser/lexer.go

12
backend/utils/nginx/parser/lexer.go

@ -3,6 +3,7 @@ package parser
import (
"bufio"
"bytes"
"fmt"
"github.com/1Panel-dev/1Panel/backend/utils/nginx/parser/flag"
"io"
)
@ -137,17 +138,22 @@ func (s *lexer) scanQuotedString(delimiter rune) flag.Flag {
if ch == '\\' {
if needsEscape(s.peek(), delimiter) {
switch s.read() {
nextch := s.read()
switch nextch {
case 'n':
fmt.Println("n")
buf.WriteRune('\n')
case 'r':
fmt.Println("r")
buf.WriteRune('\r')
case 't':
fmt.Println("t")
buf.WriteRune('\t')
case '\\':
buf.WriteRune('\\')
case delimiter:
buf.WriteRune(delimiter)
default:
buf.WriteRune('\\')
buf.WriteRune(nextch)
}
continue
}

Loading…
Cancel
Save