1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

Unparse/escape macros with commas, etc., correctly

Summary: Fixes T2574.

Test Plan: {F33501}

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2574

Differential Revision: https://secure.phabricator.com/D5062
This commit is contained in:
epriestley 2013-02-21 16:36:54 -08:00
parent 121ec67d0d
commit 4dc49f7a93
2 changed files with 10 additions and 2 deletions

View file

@ -28,8 +28,16 @@ final class PhabricatorMacroMemeDialogController
}
if (!$errors) {
$options = new PhutilSimpleOptions();
$data = array(
'src' => $name,
'above' => $above,
'below' => $below,
);
$string = $options->unparse($data, $escape = '}');
$result = array(
'text' => "{meme, src={$name}, above={$above}, below={$below}}",
'text' => "{meme, {$string}}",
);
return id(new AphrontAjaxResponse())->setContent($result);
}

View file

@ -10,7 +10,7 @@ final class PhabricatorRemarkupRuleMeme
public function apply($text) {
return preg_replace_callback(
'@{meme,([^}]+)}$@m',
'@{meme,((?:[^}\\\\]+|\\\\.)+)}$@m',
array($this, 'markupMeme'),
$text);
}