From fe09f80224e2bc5a14e3494249a9aaba5574c47a Mon Sep 17 00:00:00 2001 From: Flaviu Mates Date: Wed, 24 Mar 2021 18:01:52 +0200 Subject: [PATCH] TT#86652 Fix utf8 fax body encoding * decode utf8 on multipart/form-data request since we encode the json for this content type, and the fax body gets double encoded and ends up wrong Change-Id: I50d10879e5fe1ba99141e76d311641fcd5d568a1 --- lib/NGCP/Panel/Controller/API/Faxes.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/NGCP/Panel/Controller/API/Faxes.pm b/lib/NGCP/Panel/Controller/API/Faxes.pm index b0172c5bab..c217ba3666 100644 --- a/lib/NGCP/Panel/Controller/API/Faxes.pm +++ b/lib/NGCP/Panel/Controller/API/Faxes.pm @@ -7,6 +7,7 @@ use parent qw/NGCP::Panel::Role::Entities NGCP::Panel::Role::API::Faxes/; use HTTP::Headers qw(); use HTTP::Status qw(:constants); +use Encode qw/decode_utf8/; use NGCP::Panel::Utils::DateTime; use NGCP::Panel::Utils::API::Subscribers; @@ -119,7 +120,7 @@ sub create_item { subscriber => $billing_subscriber, destination => $form->values->{destination}, upload => $form->values->{faxfile}, - data => $form->values->{data}, + data => $c->req->headers->content_type eq 'multipart/form-data' ? decode_utf8($form->values->{data}) : $form->values->{data} ); $c->log->debug("faxserver output:\n"); $c->log->debug($output);