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 @@ + tags in the document body + // to direct user agents to icons, like this: + // + // + // + // 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()); + } +}