From 705156f9aee7aff7e96a7ef9ce923200025c27d1 Mon Sep 17 00:00:00 2001 From: Ghanshyam Katriya Date: Thu, 4 Jan 2018 05:48:52 +0530 Subject: [PATCH] Update index.php (#2948) Check whether loaded file is xml or not, if not xml than set Content-Type to text/plain --- app/provision/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index 69c5046eb0..0c0d6087ef 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -444,8 +444,14 @@ header("Content-Type: text/plain; charset=iso-8859-1"); header("Content-Length: ".strlen($file_contents)); } else { - header("Content-Type: text/xml; charset=utf-8"); - header("Content-Length: ".strlen($file_contents)); + $result = simplexml_load_string ($file_contents, 'SimpleXmlElement', LIBXML_NOERROR+LIBXML_ERR_FATAL+LIBXML_ERR_NONE); + if (false == $result){ + header("Content-Type: text/plain"); + header("Content-Length: ".strval(strlen($file_contents))); + } else { + header("Content-Type: text/xml; charset=utf-8"); + header("Content-Length: ".strlen($file_contents)); + } } } echo $file_contents;