Skip to content

Commit

Permalink
Fix the last printable character gets lost if it is preceded by speci…
Browse files Browse the repository at this point in the history
…al symbol #135
  • Loading branch information
lexx-bright committed Nov 27, 2024
1 parent 828edbd commit 21a4359
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion helper/escape/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func escapeTo(s string, mode encoding, sb *stringutils.Builder) {
if pos == 0 {
sb.WriteString(s)
return
} else if pos < len(s)-1 {
} else if pos < len(s) {
sb.WriteString(s[pos:])
}
}
22 changes: 11 additions & 11 deletions tests/plain/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ input = [
"cpu.loadavg;env=test;host=host1 2.1 1625478240",
"test.host1.cpu.loadavg 9.4 1625478300",
"cpu.loadavg;host=host1;env=test 1.3 1625478360",
"spec_symbols;minus=-;plus=+;percent=%;underscore=_;colon=:;hash=#;forward=/ 5.1 1625478360",
"spec_symbols;minus=-;plus=+;percent=%;underscore=_;colon=:;hash=#;forward=/a 5.1 1625478360",
"non-ascii.иван;tagged=true 1.2 1625478240"
]

Expand Down Expand Up @@ -155,23 +155,23 @@ output = [
]

# Tests for issue #116
# spec_symbols;minus=-;plus=+;percent=%;underscore=_;colon=:;hash=#;forward=/ 5.1 1625478360
# spec_symbols;minus=-;plus=+;percent=%;underscore=_;colon=:;hash=#;forward/0=/0 5.1 1625478360
[[test.verify]]
query = "SELECT Date, Tag1, Path, arraySort(Tags) as Tags FROM graphite_tags WHERE Path LIKE 'spec_symbols?%' ORDER BY Date, Tag1, Path"
output = [
"2021-07-05 __name__=spec_symbols spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 colon=: spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 forward=/ spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 hash=# spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 minus=- spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 percent=% spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 plus=+ spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 underscore=_ spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward=/','hash=#','minus=-','percent=%','plus=+','underscore=_']"
"2021-07-05 __name__=spec_symbols spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 colon=: spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 forward/0=/0 spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 hash=# spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 minus=- spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 percent=% spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 plus=+ spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']",
"2021-07-05 underscore=_ spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ ['__name__=spec_symbols','colon=:','forward/0=/0','hash=#','minus=-','percent=%','plus=+','underscore=_']"
]
[[test.verify]]
query = "SELECT Path, Value, Time, Date, Timestamp FROM graphite WHERE Path LIKE 'spec_symbols?%' ORDER BY Time, Path"
output = [
"spec_symbols?colon=%3A&forward=%2F&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ 5.1 1625478360 2021-07-05 0"
"spec_symbols?colon=%3A&forward%2F0=%2F0&hash=%23&minus=-&percent=%25&plus=%2B&underscore=_ 5.1 1625478360 2021-07-05 0"
]

# Tests for non-ASCII symbols in path
Expand Down

0 comments on commit 21a4359

Please sign in to comment.