diff options
| author | Caleb Maclennan <caleb@alerque.com> | 2022-03-19 17:42:53 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-19 17:42:53 +0300 |
| commit | a36818d3f3afd8758ec10991a5cb08ebdaca6329 (patch) | |
| tree | 445c27832ac4fb48a03c146fa7c797dc4880c099 /src/mime.lua | |
| parent | 6952262e6a1315b14935ddd0ea511c202c0154ba (diff) | |
| parent | 8390d07774a1ba1a597d809a1a2562d88ecce19d (diff) | |
| download | luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.tar.gz luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.tar.bz2 luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.zip | |
Merge pull request #354 from lunarmodules/linter
Diffstat (limited to 'src/mime.lua')
| -rw-r--r-- | src/mime.lua | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mime.lua b/src/mime.lua index d3abac5..93539de 100644 --- a/src/mime.lua +++ b/src/mime.lua | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | local base = _G | 10 | local base = _G |
| 11 | local ltn12 = require("ltn12") | 11 | local ltn12 = require("ltn12") |
| 12 | local mime = require("mime.core") | 12 | local mime = require("mime.core") |
| 13 | local string = require("string") | ||
| 14 | local _M = mime | 13 | local _M = mime |
| 15 | 14 | ||
| 16 | -- encode, decode and wrap algorithm tables | 15 | -- encode, decode and wrap algorithm tables |
| @@ -18,7 +17,7 @@ local encodet, decodet, wrapt = {},{},{} | |||
| 18 | 17 | ||
| 19 | _M.encodet = encodet | 18 | _M.encodet = encodet |
| 20 | _M.decodet = decodet | 19 | _M.decodet = decodet |
| 21 | _M.wrapt = wrapt | 20 | _M.wrapt = wrapt |
| 22 | 21 | ||
| 23 | -- creates a function that chooses a filter by name from a given table | 22 | -- creates a function that chooses a filter by name from a given table |
| 24 | local function choose(table) | 23 | local function choose(table) |
| @@ -27,7 +26,7 @@ local function choose(table) | |||
| 27 | name, opt1, opt2 = "default", name, opt1 | 26 | name, opt1, opt2 = "default", name, opt1 |
| 28 | end | 27 | end |
| 29 | local f = table[name or "nil"] | 28 | local f = table[name or "nil"] |
| 30 | if not f then | 29 | if not f then |
| 31 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) | 30 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) |
| 32 | else return f(opt1, opt2) end | 31 | else return f(opt1, opt2) end |
| 33 | end | 32 | end |
| @@ -52,13 +51,6 @@ decodet['quoted-printable'] = function() | |||
| 52 | return ltn12.filter.cycle(_M.unqp, "") | 51 | return ltn12.filter.cycle(_M.unqp, "") |
| 53 | end | 52 | end |
| 54 | 53 | ||
| 55 | local function format(chunk) | ||
| 56 | if chunk then | ||
| 57 | if chunk == "" then return "''" | ||
| 58 | else return string.len(chunk) end | ||
| 59 | else return "nil" end | ||
| 60 | end | ||
| 61 | |||
| 62 | -- define the line-wrap filters | 54 | -- define the line-wrap filters |
| 63 | wrapt['text'] = function(length) | 55 | wrapt['text'] = function(length) |
| 64 | length = length or 76 | 56 | length = length or 76 |
