Differential D19274 Diff 46137 src/applications/files/controller/PhabricatorFileDocumentController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/controller/PhabricatorFileDocumentController.php
Show All 37 Lines | if (!isset($engines[$engine_key])) { | ||||
return $this->newErrorResponse( | return $this->newErrorResponse( | ||||
pht( | pht( | ||||
'The engine ("%s") is unknown, or unable to render this document.', | 'The engine ("%s") is unknown, or unable to render this document.', | ||||
$engine_key)); | $engine_key)); | ||||
} | } | ||||
$engine = $engines[$engine_key]; | $engine = $engines[$engine_key]; | ||||
$this->engine = $engine; | $this->engine = $engine; | ||||
$encode_setting = $request->getStr('encode'); | |||||
if (strlen($encode_setting)) { | |||||
$engine->setEncodingConfiguration($encode_setting); | |||||
} | |||||
$highlight_setting = $request->getStr('highlight'); | |||||
if (strlen($highlight_setting)) { | |||||
$engine->setHighlightingConfiguration($highlight_setting); | |||||
} | |||||
try { | try { | ||||
$content = $engine->newDocument($ref); | $content = $engine->newDocument($ref); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
return $this->newErrorResponse($ex->getMessage()); | return $this->newErrorResponse($ex->getMessage()); | ||||
} | } | ||||
return $this->newContentResponse($content); | return $this->newContentResponse($content); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |