RawAction: Add json to the allowed content types
authorAmir Sarabadani <ladsgroup@gmail.com>
Fri, 13 Oct 2017 18:37:18 +0000 (20:37 +0200)
committerAmir Sarabadani <ladsgroup@gmail.com>
Sun, 22 Oct 2017 11:44:20 +0000 (13:44 +0200)
This is not the best way to handle json type but
I'm trying to clean this up a little in other patches

Bug: T178060
Change-Id: Ia6d0c4b8c1062966da48e3bebf057c621b39ba87

includes/actions/RawAction.php

index d8c8bc3..be10ae4 100644 (file)
@@ -236,7 +236,13 @@ class RawAction extends FormlessAction {
                        }
                }
 
                        }
                }
 
-               $allowedCTypes = [ 'text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit' ];
+               $allowedCTypes = [
+                       'text/x-wiki',
+                       'text/javascript',
+                       'text/css',
+                       'application/x-zope-edit',
+                       'application/json'
+               ];
                if ( $ctype == '' || !in_array( $ctype, $allowedCTypes ) ) {
                        $ctype = 'text/x-wiki';
                }
                if ( $ctype == '' || !in_array( $ctype, $allowedCTypes ) ) {
                        $ctype = 'text/x-wiki';
                }