1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Fix fatal during redirection safety check for searching for Phabricator base-uri with no trailing slash

Summary: Fixes T13412. If you search for "https://phabricator.example.com" with no trailing slash, we currently redirect you to "", which is fouled by a safety check in the redirection flow.

Test Plan:
  - Searched for "https://local.phacility.com"; before: fatal in redirection; after: clean redirect.
  - Searched for other self-URIs, got normal redirects.

Maniphest Tasks: T13412

Differential Revision: https://secure.phabricator.com/D20794
This commit is contained in:
epriestley 2019-09-09 12:28:17 -07:00
parent 278092974f
commit aaaea57591

View file

@ -26,7 +26,17 @@ final class PhabricatorDatasourceURIEngineExtension
->setProtocol(null) ->setProtocol(null)
->setPort(null); ->setPort(null);
return phutil_string_cast($uri); $uri = phutil_string_cast($uri);
// See T13412. If the URI was in the form "http://dev.example.com" with
// no trailing slash, there may be no path. Redirecting to the empty
// string is considered an error by safety checks during redirection,
// so treat this like the user entered the URI with a trailing slash.
if (!strlen($uri)) {
$uri = '/';
}
return $uri;
} }
return null; return null;