|
| 1 | +Ticket MAGETWO-57414 |
| 2 | +diff -Naur a/vendor/magento/framework/App/StaticResource.php b/vendor/magento/framework/App/StaticResource.php |
| 3 | +index d591deb..6344322 100644 |
| 4 | +--- a/vendor/magento/framework/App/StaticResource.php |
| 5 | ++++ b/vendor/magento/framework/App/StaticResource.php |
| 6 | +@@ -94,24 +94,40 @@ class StaticResource implements \Magento\Framework\AppInterface |
| 7 | + { |
| 8 | + // disabling profiling when retrieving static resource |
| 9 | + \Magento\Framework\Profiler::reset(); |
| 10 | +- $appMode = $this->state->getMode(); |
| 11 | +- if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) { |
| 12 | ++ $path = $this->getResourcePath(); |
| 13 | ++ if (!isset($path)) { |
| 14 | + $this->response->setHttpResponseCode(404); |
| 15 | +- } else { |
| 16 | +- $path = $this->request->get('resource'); |
| 17 | +- $params = $this->parsePath($path); |
| 18 | +- $this->state->setAreaCode($params['area']); |
| 19 | +- $this->objectManager->configure($this->configLoader->load($params['area'])); |
| 20 | +- $file = $params['file']; |
| 21 | +- unset($params['file']); |
| 22 | +- $asset = $this->assetRepo->createAsset($file, $params); |
| 23 | +- $this->response->setFilePath($asset->getSourceFile()); |
| 24 | +- $this->publisher->publish($asset); |
| 25 | ++ return $this->response; |
| 26 | + } |
| 27 | ++ |
| 28 | ++ $params = $this->parsePath($path); |
| 29 | ++ $this->state->setAreaCode($params['area']); |
| 30 | ++ $this->objectManager->configure($this->configLoader->load($params['area'])); |
| 31 | ++ $file = $params['file']; |
| 32 | ++ unset($params['file']); |
| 33 | ++ $asset = $this->assetRepo->createAsset($file, $params); |
| 34 | ++ $this->response->setFilePath($asset->getSourceFile()); |
| 35 | ++ $this->publisher->publish($asset); |
| 36 | + return $this->response; |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | ++ * Retrieve the path from either the GET parameter or the request |
| 41 | ++ * URI, depending on whether webserver rewrites are in use. |
| 42 | ++ */ |
| 43 | ++ protected function getResourcePath() { |
| 44 | ++ $path = $this->request->get('resource'); |
| 45 | ++ if (isset($path)) { |
| 46 | ++ return $path; |
| 47 | ++ } |
| 48 | ++ |
| 49 | ++ $path = $this->request->getUri()->getPath(); |
| 50 | ++ if (preg_match("~^/static/(?:version\d*/)?(.*)$~", $path, $matches)) { |
| 51 | ++ return $matches[1]; |
| 52 | ++ } |
| 53 | ++ } |
| 54 | ++ |
| 55 | ++ /** |
| 56 | + * @inheritdoc |
| 57 | + */ |
| 58 | + public function catchException(Bootstrap $bootstrap, \Exception $exception) |
0 commit comments