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:
parent
121ec67d0d
commit
4dc49f7a93
2 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ final class PhabricatorRemarkupRuleMeme
|
|||
|
||||
public function apply($text) {
|
||||
return preg_replace_callback(
|
||||
'@{meme,([^}]+)}$@m',
|
||||
'@{meme,((?:[^}\\\\]+|\\\\.)+)}$@m',
|
||||
array($this, 'markupMeme'),
|
||||
$text);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue