commit a3b3c160f57a4636f7963a5495fa44a24b82cbae
parent 9e45fd5b1b66f6a8043ff88ee70f789b0250e037
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 28 Jan 2022 11:12:24 +0100
mime: better approach to quoted-string
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mime/parse.ha b/mime/parse.ha
@@ -65,14 +65,13 @@ fn quoted(in: str) (str | errors::invalid) = {
//
// This implementation should handle most Media Types seen in practice
// unless they're doing something weird and ill-advised with them.
- in = strings::sub(in, 1, strings::end);
- const items = strings::cut(in, "\"");
+ in = strings::trim(in, '"');
if (strings::contains(in, "\\")
|| strings::contains(in, "\r")
|| strings::contains(in, "\n")) {
return errors::invalid;
};
- return items.0;
+ return in;
};
fn typevalid(in: str) (void | errors::invalid) = {