@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix AphrontCrumbView (phutil_tag)

Summary: Proper fix is to do some layout work in Diffusion. Short of that, make this escape properly.

Test Plan: Viewed various crumbs, no more overescaping for non-diffusion crumbs.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D4641

+15 -25
+11 -10
src/applications/diffusion/controller/DiffusionController.php
··· 246 246 break; 247 247 case 'change': 248 248 $view_name = 'Change'; 249 - $crumb_list[] = $crumb->setRawName( 250 - phutil_escape_html($path).' ('.$commit_link.')' 251 - ); 249 + $crumb_list[] = $crumb->setName( 250 + phutil_safe_html( 251 + phutil_escape_html($path).' ('.$commit_link.')')); 252 252 return $crumb_list; 253 253 } 254 254 ··· 293 293 $path_sections = '/'.implode('/', $path_sections); 294 294 295 295 $crumb_list[] = id(new PhabricatorCrumbView()) 296 - ->setRawName($path_sections); 296 + ->setName(phutil_safe_html($path_sections)); 297 297 } 298 298 299 299 $last_crumb = array_pop($crumb_list); ··· 308 308 ) + $uri_params), 309 309 ), 310 310 'Jump to HEAD'); 311 - $last_crumb->setRawName( 312 - $last_crumb->getNameForRender() . " @ {$commit_link} ({$jump_link})" 313 - ); 311 + 312 + $name = $last_crumb->getName(); 313 + $name = phutil_safe_html($name." @ {$commit_link} ({$jump_link})"); 314 + $last_crumb->setName($name); 314 315 } else if ($spec['view'] != 'lint') { 315 - $last_crumb->setRawName( 316 - $last_crumb->getNameForRender() . " @ HEAD" 317 - ); 316 + $name = $last_crumb->getName(); 317 + $name = phutil_safe_html($name.' @ HEAD'); 318 + $last_crumb->setName($name); 318 319 } 319 320 320 321 $crumb_list[] = $last_crumb;
+4 -15
src/view/layout/PhabricatorCrumbView.php
··· 6 6 private $href; 7 7 private $icon; 8 8 private $isLastCrumb; 9 - private $rawName; 10 - 11 - /** 12 - * Allows for custom HTML inside the name field. 13 - * 14 - * NOTE: you must handle escaping user text if you use this method. 15 - */ 16 - public function setRawName($raw_name) { 17 - $this->rawName = $raw_name; 18 - return $this; 19 - } 20 9 21 10 public function setName($name) { 22 11 $this->name = $name; 23 12 return $this; 24 13 } 25 14 26 - public function getNameForRender() { 27 - return nonempty($this->rawName, phutil_escape_html($this->name)); 15 + public function getName() { 16 + return $this->name; 28 17 } 29 18 30 19 public function setHref($href) { ··· 63 52 ''); 64 53 } 65 54 66 - $name = phutil_render_tag( 55 + $name = phutil_tag( 67 56 'span', 68 57 array( 69 58 'class' => 'phabricator-crumb-name', 70 59 ), 71 - $this->getNameForRender()); 60 + $this->name); 72 61 73 62 $divider = null; 74 63 if (!$this->isLastCrumb) {