Page MenuHomePhorge

Fix is_absolute test in markup
ClosedPublic

Authored by avivey on Apr 28 2023, 10:44.
Tags
None
Referenced Files
F2179370: D25139.diff
Sun, May 5, 16:57
Unknown Object (File)
Thu, May 2, 09:53
Unknown Object (File)
Wed, May 1, 21:28
Unknown Object (File)
Wed, May 1, 21:28
Unknown Object (File)
Wed, May 1, 21:28
Unknown Object (File)
Wed, May 1, 10:20
Unknown Object (File)
Sun, Apr 7, 21:38
Unknown Object (File)
Sat, Apr 6, 22:37

Details

Summary

See Q53. Fixes rP935d7120ee32.

Call sites should be happy to use PhutilURI when possible.

Test Plan

visit any Repository page. Before - exception, now - data.

Diff Detail

Repository
rP Phorge
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 277
Build 277: arc lint + arc unit

Event Timeline

avivey requested review of this revision.Apr 28 2023, 10:44
avivey edited the summary of this revision. (Show Details)

lint

Thank you, it seems also a bit more efficient since there is no need to run a preg match for that case.

With that strict check I will +1 as O1

src/infrastructure/javelin/markup.php
81

I would recommend a strict check here to avoid type juggling (0 == null) is true etc.

https://www.php.net/manual/en/types.comparisons.php

Even if probably it would be nice to have an isAbsoluteURI() method in PhutilURI to reduce the business logic here

Even if probably it would be nice to have an isAbsoluteURI() method in PhutilURI to reduce the business logic here

I looked into it, but (1) it's in a different repo, so the fix would be harder and (2) the test here isn't really "is absolute" but rather "does this look like a web URI". PhutilURI is also used for git/svn/ssh URIs, which would be "absolute" and also make no sense here.

src/infrastructure/javelin/markup.php
81

👍

This revision was not accepted when it landed; it landed in state Needs Review.Apr 28 2023, 11:10
This revision was automatically updated to reflect the committed changes.

I would like to approve this but it's too late :D thanks