Skip to content

Commit

Permalink
fix: 反向代理的文本替换不兼容 " 符号的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengkunwang223 committed Jan 18, 2024
1 parent 5152e7b commit 10cb6a6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/utils/nginx/parser/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package parser
import (
"bufio"
"bytes"
"fmt"
"github.com/1Panel-dev/1Panel/backend/utils/nginx/parser/flag"
"io"
)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 10cb6a6

Please sign in to comment.