From 51f4c833526f1488703f309f2ed5eeff5eded8f2 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Oct 2021 15:22:22 +0200 Subject: [PATCH] multipart: more lenient content-type parsing It's not uncommon for files to have mime types like `image/svg+xml`. The + in there was tripping up the strictly-`@ta` parser for the content-type. Here we change the parser to accept +, and all the other characters that the `@t` parser accepts. This is perhaps a bit overkill, but we primarily care about getting the parsed request to the caller. If any further validation is required, it can happen upstream. Fixes #5282. --- pkg/garden/lib/multipart.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/garden/lib/multipart.hoon b/pkg/garden/lib/multipart.hoon index 0342c46f77..4f047ae57e 100644 --- a/pkg/garden/lib/multipart.hoon +++ b/pkg/garden/lib/multipart.hoon @@ -37,7 +37,7 @@ ++ cut (jest 'Content-Type: ') ++ dim (jest (cat 3 '--' del)) ++ nip (jest '\0d\0a') - ++ nab (more fas urs:ab) + ++ nab (more fas (cook (cury rap 3) (plus qit))) ++ nag (dine ;~(less ;~(plug nip dim) next)) ++ nod (dine ;~(less doq next)) ++ nom (dine alp)