@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.

Properly transform Celerity resource URIs with query strings and anchors

Summary:
See <https://github.com/facebook/phabricator/commit/6a45b7e67091a217a28414cdcc8d02b50875a7d6>

These URIs have "?hack=iefix#ieieielol" on them, which the parser doesn't recognize as a known resource, so it errs on the side of caution by not rewriting.

Instead, strip this bit off, attempt to rewrite, then put it back on.

Test Plan: Loaded `font-awesome.css` locally and saw properly rewritten URIs.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

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

+12 -1
+12 -1
src/infrastructure/celerity/CelerityResourceTransformer.php
··· 111 111 112 112 public function translateResourceURI(array $matches) { 113 113 $uri = trim($matches[1], "'\" \r\t\n"); 114 + $tail = ''; 115 + 116 + // If the resource URI has a query string or anchor, strip it off before 117 + // we go looking for the resource. We'll stitch it back on later. This 118 + // primarily affects FontAwesome. 119 + 120 + $parts = preg_split('/(?=[?#])/', $uri, 2); 121 + if (count($parts) == 2) { 122 + $uri = $parts[0]; 123 + $tail = $parts[1]; 124 + } 114 125 115 126 $alternatives = array_unique( 116 127 array( ··· 142 153 } 143 154 } 144 155 145 - return 'url('.$uri.')'; 156 + return 'url('.$uri.$tail.')'; 146 157 } 147 158 148 159 private function replaceCSSVariables($path, $data) {