Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | util.startup: Provide a common Lua 5.3+ math.type() for Lua 5.2 | Kim Alvefur | 2022-10-19 | 1 | -3/+1 |
| | | | | Code deduplication | ||||
* | compat: Use table.pack (there since Lua 5.2) over our util.table | Kim Alvefur | 2022-07-11 | 1 | -1/+1 |
| | | | | | Added in d278a770eddc avoid having to deal with its absence in Lua 5.1. No longer needed when Lua 5.1 support is dropped. | ||||
* | compat: Remove handling of Lua 5.1 location of 'unpack' function | Kim Alvefur | 2022-07-11 | 1 | -1/+1 |
| | |||||
* | util: Remove various Lua 5.1 compatibility hacks | Kim Alvefur | 2022-07-02 | 1 | -3/+0 |
| | | | | Part of #1600 | ||||
* | util.format: Fix typo in comment [codespell] | Kim Alvefur | 2022-02-04 | 1 | -1/+1 |
| | |||||
* | util.format: Expand explanation of purpose in comments | Kim Alvefur | 2022-01-27 | 1 | -1/+6 |
| | |||||
* | util.format: Skip control code escaping when doing full serialization | Kim Alvefur | 2022-01-27 | 1 | -1/+1 |
| | | | | | | Fixes that a multi-line string ended up "like\ \9this" instead of "like\nthis" as can be demonstrated by somehow initiating a connection to a HTTP server. | ||||
* | util.format: Optimize most common integer format | Kim Alvefur | 2021-12-13 | 1 | -0/+2 |
| | | | | | | A search for log formats in use points to %s being the most common, followed by %d, so worth having a fast path for that. %g works well with most numbers and is what Lua 5.1 and 5.2 used | ||||
* | util.format: Ensure metatable __tostring results are also sanitized | Kim Alvefur | 2021-12-13 | 1 | -1/+2 |
| | |||||
* | util.format: Fix some formats expecting positive numbers in Lua 5.2 | Kim Alvefur | 2021-12-11 | 1 | -0/+5 |
| | | | | Amazing how string.format behaves differently under each Lua version | ||||
* | util.format: Fix Lua 5.1 quirks thanks to ALL THE TESTS | Kim Alvefur | 2021-12-11 | 1 | -1/+6 |
| | |||||
* | util.format: Also handle the %p format added in Lua 5.4 | Kim Alvefur | 2021-12-11 | 1 | -3/+18 |
| | |||||
* | util.format: Ensure sanitation of strings passed to wrong format | Kim Alvefur | 2021-12-11 | 1 | -21/+37 |
| | | | | | | | | | Ie. log("debug", "%d", "\1\2\3") should not result in garbage. Also optimizing for the common case of ASCII string passed to %s and early returns everywhere. Returning nil from a gsub callback keeps the original substring. | ||||
* | util.format: Escape invalid UTF-8 by passing trough serialization | Kim Alvefur | 2021-12-10 | 1 | -1/+10 |
| | | | | | | Should prevent invalid UTF-8 from making it into the logs, which can cause trouble with terminals or log viewers or other tools, such as when grep determines that log files are binary. | ||||
* | util.format: Escape ASCII control characters also in extra arguments | Kim Alvefur | 2021-07-03 | 1 | -1/+1 |
| | |||||
* | util.format: Allow newlines but ensure following lines are indented | Kim Alvefur | 2021-07-03 | 1 | -1/+1 |
| | | | | | This should a) prevent injection of text that looks like legitimate log lines and b) not mangle tracebacks. | ||||
* | util.format: Fix missing backslash in pattern | Kim Alvefur | 2021-07-03 | 1 | -1/+1 |
| | | | | | Made the pattern match a longer range than intended, but with no effect since those characters are not present in the 'control_symbols' table. | ||||
* | util.format: Change formatting of nil values to avoid looking like XML | Kim Alvefur | 2021-06-29 | 1 | -2/+2 |
| | |||||
* | util.format: Escape ASCII control characters in output | Kim Alvefur | 2021-06-15 | 1 | -1/+16 |
| | | | | | | | This should offer some protection against doing evil things to terminals. Doesn't protect against pure broken UTF-8 garbage however. See #734 | ||||
* | util.format: Handle integer formats the same way on Lua versions without ↵ | Kim Alvefur | 2019-05-30 | 1 | -2/+5 |
| | | | | integer support | ||||
* | util.format: Handle formats expecting an integer in Lua 5.3+ (fixes #1371) | Kim Alvefur | 2019-05-30 | 1 | -0/+6 |
| | |||||
* | util.format: Serialize values for the %q format | Kim Alvefur | 2018-10-12 | 1 | -1/+5 |
| | | | | Improves eg debug logs | ||||
* | util.format: Use pack from util.table | Kim Alvefur | 2018-12-08 | 1 | -2/+3 |
| | |||||
* | util.format: Tweak how nil values are handled | Kim Alvefur | 2018-11-28 | 1 | -5/+4 |
| | | | | Because [<nil>] seems exsessive | ||||
* | util.format: Import unpack from table lib in Lua 5.2+ | Kim Alvefur | 2017-11-23 | 1 | -1/+1 |
| | |||||
* | util.format: Move tests to spec/ | Kim Alvefur | 2017-11-10 | 1 | -10/+0 |
| | |||||
* | util: Various minor changes to please [luacheck] | Kim Alvefur | 2017-11-10 | 1 | -4/+4 |
| | |||||
* | util.format: A string.format wrapper that gracefully handles invalid arguments | Waqas Hussain | 2017-09-10 | 1 | -0/+74 |