1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

isSelfURI: fix anchors and relative URIs (that are "self" indeed)

Summary:
Example cases that were wrongly considered external URLs:

- "#foo"
- "/foo"

Note that Phorge usually does not change stable things. In fact this thing
was not documented even inline, and was not even in the unit tests.

So this is a fix, and not a breaking change. Probably no one had ever tried it.

Closes T15182

Test Plan:
The already existing unit tests still work.

The added ones make sense.

There are no problems doing other random things.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15182

Differential Revision: https://we.phorge.it/D25555
This commit is contained in:
Valerio Bozzolan 2024-03-19 17:34:07 +01:00
parent 8fe3d68577
commit 328aee033f
2 changed files with 7 additions and 1 deletions

View file

@ -433,7 +433,7 @@ final class PhabricatorEnv extends Phobject {
$host = $uri->getDomain();
if (!phutil_nonempty_string($host)) {
return false;
return true;
}
$host = phutil_utf8_strtolower($host);

View file

@ -243,6 +243,12 @@ final class PhabricatorEnvTestCase extends PhabricatorTestCase {
'https://old.example.com/path/to/resource.png' => true,
'https://other.example.com/' => false,
'/' => true,
'/self' => true,
'#self' => true,
'/#self' => true,
'/self/#self' => true,
);
foreach ($map as $input => $expect) {