From 48334568984eafd20fe82f54106e93eec49349d7 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Thu, 24 Apr 2025 10:50:50 +0200 Subject: [PATCH] FU: Accept charset argument in JSON request content-type header --- FU.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FU.pm b/FU.pm index ffdc9bd..423c6e1 100644 --- a/FU.pm +++ b/FU.pm @@ -689,7 +689,7 @@ sub cookie { sub json { shift; - fu->error(400, "Invalid content type for json") if (fu->header('content-type')||'') ne 'application/json'; + fu->error(400, "Invalid content type for json") if (fu->header('content-type')||'') !~ m{^application/json(?:;\s*charset=utf-?8)?$}i; return FU::Util::utf8_decode(my $x = $FU::REQ->{body}) if !@_; $FU::REQ->{json} ||= eval { FU::Util::json_parse($FU::REQ->{body}, utf8 => 1)