Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/controller/PhabricatorFileDataController.php
Show All 23 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$alt_uri = new PhutilURI($alt); | $alt_uri = new PhutilURI($alt); | ||||
$alt_domain = $alt_uri->getDomain(); | $alt_domain = $alt_uri->getDomain(); | ||||
$req_domain = $request->getHost(); | $req_domain = $request->getHost(); | ||||
$main_domain = id(new PhutilURI($base_uri))->getDomain(); | $main_domain = id(new PhutilURI($base_uri))->getDomain(); | ||||
$request_kind = $request->getURIData('kind'); | $request_kind = $request->getURIData('kind'); | ||||
$is_download = ($request_kind === 'download'); | $is_download = ($request_kind === 'download'); | ||||
if (!strlen($alt) || $main_domain == $alt_domain) { | if (!phutil_nonempty_string($alt) || $main_domain == $alt_domain) { | ||||
valerio.bozzolan: ✅ It seems `$alt_uri->getDomain()` is null as default and usages seems to just use `setDomain… | |||||
// No alternate domain. | // No alternate domain. | ||||
$should_redirect = false; | $should_redirect = false; | ||||
$is_alternate_domain = false; | $is_alternate_domain = false; | ||||
} else if ($req_domain != $alt_domain) { | } else if ($req_domain != $alt_domain) { | ||||
// Alternate domain, but this request is on the main domain. | // Alternate domain, but this request is on the main domain. | ||||
$should_redirect = true; | $should_redirect = true; | ||||
$is_alternate_domain = false; | $is_alternate_domain = false; | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 238 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ It seems $alt_uri->getDomain() is null as default and usages seems to just use setDomain(string).
The phutil_nonempty_string() will report alien values and this is OK.