@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix is_absolute test in markup

Summary:
See Q59. Fixes rP935d7120ee32.

Call sites should be happy to use PhutilURI when possible.

Test Plan: visit any Repository page. Before - exception, now - data.

Reviewers: O1 Blessed Committers!, valerio.bozzolan

Reviewed By: valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25139

+20 -2
+20 -2
src/infrastructure/javelin/markup.php
··· 77 77 $is_post = (strcasecmp($http_method, 'POST') === 0); 78 78 79 79 $http_action = idx($attributes, 'action'); 80 - $is_absolute_uri = 0; 81 - if (phutil_nonempty_string($http_action)) { 80 + 81 + if ($http_action === null) { 82 + // Not sure what this is. 83 + $is_absolute_uri = false; 84 + 85 + } else if ($http_action instanceof PhutilURI) { 86 + // This is the happy path, I think 87 + 88 + // For now, this is close enough - I suspect we'll stay with "https" schema 89 + // for the rest of eternity. 90 + $protocol = $http_action->getProtocol(); 91 + $is_absolute_uri = ($protocol == 'http' || $protocol == 'https'); 92 + 93 + } else if (is_string($http_action)) { 94 + // Also good path? 82 95 $is_absolute_uri = preg_match('#^(https?:|//)#', $http_action); 96 + } else { 97 + throw new Exception( 98 + pht( 99 + 'Unexpected object type provided as `action` - %s', 100 + gettype($http_action))); 83 101 } 84 102 85 103 if ($is_post) {