Page MenuHomePhabricator

D21195.id.diff
No OneTemporary

D21195.id.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3371,6 +3371,7 @@
'PhabricatorFactRaw' => 'applications/fact/storage/PhabricatorFactRaw.php',
'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php',
'PhabricatorFailHisecUserLogType' => 'applications/people/userlog/PhabricatorFailHisecUserLogType.php',
+ 'PhabricatorFaviconController' => 'applications/system/controller/PhabricatorFaviconController.php',
'PhabricatorFaviconRef' => 'applications/files/favicon/PhabricatorFaviconRef.php',
'PhabricatorFaviconRefQuery' => 'applications/files/favicon/PhabricatorFaviconRefQuery.php',
'PhabricatorFavoritesApplication' => 'applications/favorites/application/PhabricatorFavoritesApplication.php',
@@ -9852,6 +9853,7 @@
'PhabricatorFactRaw' => 'PhabricatorFactDAO',
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
'PhabricatorFailHisecUserLogType' => 'PhabricatorUserLogType',
+ 'PhabricatorFaviconController' => 'PhabricatorController',
'PhabricatorFaviconRef' => 'Phobject',
'PhabricatorFaviconRefQuery' => 'Phobject',
'PhabricatorFavoritesApplication' => 'PhabricatorApplication',
diff --git a/src/applications/system/application/PhabricatorSystemApplication.php b/src/applications/system/application/PhabricatorSystemApplication.php
--- a/src/applications/system/application/PhabricatorSystemApplication.php
+++ b/src/applications/system/application/PhabricatorSystemApplication.php
@@ -24,6 +24,7 @@
return array(
'/status/' => 'PhabricatorStatusController',
'/debug/' => 'PhabricatorDebugController',
+ '/favicon.ico' => 'PhabricatorFaviconController',
'/robots.txt' => 'PhabricatorRobotsController',
'/services/' => array(
'encoding/' => 'PhabricatorSystemSelectEncodingController',
diff --git a/src/applications/system/controller/PhabricatorFaviconController.php b/src/applications/system/controller/PhabricatorFaviconController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/system/controller/PhabricatorFaviconController.php
@@ -0,0 +1,36 @@
+<?php
+
+final class PhabricatorFaviconController
+ extends PhabricatorController {
+
+ public function shouldRequireLogin() {
+ return false;
+ }
+
+ public function handleRequest(AphrontRequest $request) {
+ // See PHI1719. Phabricator uses "<link /"> tags in the document body
+ // to direct user agents to icons, like this:
+ //
+ // <link rel="icon" href="..." />
+ //
+ // However, some software requests the hard-coded path "/favicon.ico"
+ // directly. To tidy the logs, serve some reasonable response rather than
+ // a 404.
+
+ // NOTE: Right now, this only works for the "PhabricatorPlatformSite".
+ // Other sites (like custom Phame blogs) won't currently route this
+ // path.
+
+ $ref = id(new PhabricatorFaviconRef())
+ ->setWidth(64)
+ ->setHeight(64);
+
+ id(new PhabricatorFaviconRefQuery())
+ ->withRefs(array($ref))
+ ->execute();
+
+ return id(new AphrontRedirectResponse())
+ ->setIsExternal(true)
+ ->setURI($ref->getURI());
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 5:29 PM (19 h, 44 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7042122
Default Alt Text
D21195.id.diff (3 KB)

Event Timeline