mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Fix production file links for some alt-domain configurations
Summary: We sometimes call PhabricatorEnv::getProductionURI($file->getBestURI()) or similar, but this may currently cause us to construct a URI like this: http://domain.com/http://cdn-domain.com/file/data/xxx/yyy/name.jpg Instead, if the provided URI has a domain already, leave it unmodified. Test Plan: Attached a file to a task; got an email with a valid URI instead of an invalid URI. Reviewers: btrahan Reviewed By: btrahan CC: Makinde, aran, epriestley Differential Revision: https://secure.phabricator.com/D1622
This commit is contained in:
parent
4bd336cedc
commit
fce6a7089c
1 changed files with 12 additions and 4 deletions
16
src/infrastructure/env/PhabricatorEnv.php
vendored
16
src/infrastructure/env/PhabricatorEnv.php
vendored
|
@ -39,11 +39,19 @@ final class PhabricatorEnv {
|
|||
}
|
||||
|
||||
public static function getProductionURI($path) {
|
||||
$uri = self::getEnvConfig('phabricator.production-uri');
|
||||
if (!$uri) {
|
||||
$uri = self::getEnvConfig('phabricator.base-uri');
|
||||
// If we're passed a URI which already has a domain, simply return it
|
||||
// unmodified. In particular, files may have URIs which point to a CDN
|
||||
// domain.
|
||||
$uri = new PhutilURI($path);
|
||||
if ($uri->getDomain()) {
|
||||
return $path;
|
||||
}
|
||||
return rtrim($uri, '/').$path;
|
||||
|
||||
$production_domain = self::getEnvConfig('phabricator.production-uri');
|
||||
if (!$production_domain) {
|
||||
$production_domain = self::getEnvConfig('phabricator.base-uri');
|
||||
}
|
||||
return rtrim($production_domain, '/').$path;
|
||||
}
|
||||
|
||||
public static function getCDNURI($path) {
|
||||
|
|
Loading…
Reference in a new issue