Skip to content

Commit 4387971

Browse files
author
Roman Ganin
committed
Merge remote-tracking branch 'origin/MAGETWO-35242' into develop
2 parents cc09f98 + 2cb2671 commit 4387971

File tree

1 file changed

+11
-7
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery

1 file changed

+11
-7
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
class Upload extends \Magento\Backend\App\Action
1212
{
1313
/**
14-
* @var \Magento\Framework\Controller\Result\JsonFactory
14+
* @var \Magento\Framework\Controller\Result\RawFactory
1515
*/
16-
protected $resultJsonFactory;
16+
protected $resultRawFactory;
1717

1818
/**
1919
* @param \Magento\Backend\App\Action\Context $context
20-
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
20+
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
2121
*/
2222
public function __construct(
2323
\Magento\Backend\App\Action\Context $context,
24-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
24+
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory
2525
) {
2626
parent::__construct($context);
27-
$this->resultJsonFactory = $resultJsonFactory;
27+
$this->resultRawFactory = $resultRawFactory;
2828
}
2929

3030
/**
@@ -36,7 +36,7 @@ protected function _isAllowed()
3636
}
3737

3838
/**
39-
* @return \Magento\Framework\Controller\Result\Json
39+
* @return \Magento\Framework\Controller\Result\Raw
4040
*/
4141
public function execute()
4242
{
@@ -72,6 +72,10 @@ public function execute()
7272
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
7373
}
7474

75-
return $this->resultJsonFactory->create()->setData($result);
75+
/** @var \Magento\Framework\Controller\Result\Raw $response */
76+
$response = $this->resultRawFactory->create();
77+
$response->setHeader('Content-type', 'text/plain');
78+
$response->setContents(json_encode($result));
79+
return $response;
7680
}
7781
}

0 commit comments

Comments
 (0)