mirror of
https://github.com/icewind1991/warp-real-ip.git
synced 2026-06-03 10:44:07 +02:00
fix maybe_bracketd for empty strings
This commit is contained in:
parent
b3b38b335b
commit
58687959ce
1 changed files with 1 additions and 1 deletions
|
|
@ -207,7 +207,7 @@ fn maybe_quoted(x: &str) -> Cow<str> {
|
|||
}
|
||||
|
||||
fn maybe_bracketed(x: &str) -> &str {
|
||||
if x.as_bytes()[0] == (b'[') && x.as_bytes()[x.len() - 1] == (b']') {
|
||||
if x.as_bytes().first() == Some(&b'[') && x.as_bytes().last() == Some(&b']') {
|
||||
&x[1..x.len() - 1]
|
||||
} else {
|
||||
x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue