1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Use full URIs to link to objects from Phame blogs

Summary: Fixes T6299.

Test Plan: Viewed live blog, saw full URIs.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: johnny-bit, epriestley

Maniphest Tasks: T6299

Differential Revision: https://secure.phabricator.com/D12793
This commit is contained in:
epriestley 2015-05-11 11:11:25 -07:00
parent 75fc4e763a
commit 3df64104de
3 changed files with 16 additions and 3 deletions

View file

@ -25,6 +25,10 @@ final class PholioRemarkupRule extends PhabricatorObjectRemarkupRule {
$href = $href.'/'.$id[1].'/';
}
if ($this->getEngine()->getConfig('uri.full')) {
$href = PhabricatorEnv::getURI($href);
}
return $href;
}

View file

@ -42,7 +42,7 @@ final class PhabricatorMarkupEngine {
private $objects = array();
private $viewer;
private $contextObject;
private $version = 14;
private $version = 15;
/* -( Markup Pipeline )---------------------------------------------------- */
@ -337,6 +337,7 @@ final class PhabricatorMarkupEngine {
public static function newPhameMarkupEngine() {
return self::newMarkupEngine(array(
'macros' => false,
'uri.full' => true,
));
}
@ -349,7 +350,6 @@ final class PhabricatorMarkupEngine {
array(
'macros' => false,
'youtube' => false,
));
}
@ -437,6 +437,7 @@ final class PhabricatorMarkupEngine {
'macros' => true,
'uri.allowed-protocols' => PhabricatorEnv::getEnvConfig(
'uri.allowed-protocols'),
'uri.full' => false,
'syntax-highlighter.engine' => PhabricatorEnv::getEnvConfig(
'syntax-highlighter.engine'),
'preserve-linebreaks' => true,
@ -464,6 +465,8 @@ final class PhabricatorMarkupEngine {
'syntax-highlighter.engine',
$options['syntax-highlighter.engine']);
$engine->setConfig('uri.full', $options['uri.full']);
$rules = array();
$rules[] = new PhutilRemarkupEscapeRemarkupRule();
$rules[] = new PhutilRemarkupMonospaceRule();

View file

@ -44,7 +44,13 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
PhabricatorObjectHandle $handle,
$id) {
return $handle->getURI();
$uri = $handle->getURI();
if ($this->getEngine()->getConfig('uri.full')) {
$uri = PhabricatorEnv::getURI($uri);
}
return $uri;
}
protected function renderObjectRefForAnyMedia (