Page MenuHomePhorge

Fix is_absolute test in markup
ClosedPublic

Authored by avivey on Apr 28 2023, 10:44.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 21:38
Unknown Object (File)
Sat, Apr 6, 22:37
Unknown Object (File)
Mon, Apr 1, 05:04
Unknown Object (File)
Mon, Apr 1, 02:57
Unknown Object (File)
Mon, Apr 1, 01:45
Unknown Object (File)
Sun, Mar 31, 07:04
Unknown Object (File)
Sun, Mar 31, 03:09
Unknown Object (File)
Wed, Mar 27, 18:04

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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