@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.

Avoid RuntimeException passing bogus "service" parameter to Diffusion commit view

Summary:
`PhabricatorRepository::parseRepositoryServicePath()` can return `null` per https://we.phorge.it/source/phorge/browse/master/src/applications/repository/storage/PhabricatorRepository.php;123831b53fb7572cba11e9c990dcb9d247614890$635, thus make the code in `DiffusionServeController:getRequestDirectoryPath()` at least not crash when handling `null` and instead fall back to serving a "403 This repository is read-only over HTTP."

There is probably a cleaner approach which I happily leave to any future person willing to figure it out.

Closes T15944

Test Plan: Go to http://phorge.localhost/rABCD0123456789abcdef0123456789abcdef01234567?service=foo

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15944

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

+14 -1
+11 -1
src/applications/diffusion/controller/DiffusionServeController.php
··· 492 492 return $result; 493 493 } 494 494 495 + /** 496 + * @return bool 497 + */ 495 498 private function isReadOnlyRequest( 496 499 PhabricatorRepository $repository) { 497 500 $request = $this->getRequest(); ··· 652 655 return id(new DiffusionGitResponse())->setGitData($stdout); 653 656 } 654 657 658 + /** 659 + * @return string 660 + */ 655 661 private function getRequestDirectoryPath(PhabricatorRepository $repository) { 656 662 $request = $this->getRequest(); 657 663 $request_path = $request->getRequestURI()->getPath(); ··· 659 665 $info = PhabricatorRepository::parseRepositoryServicePath( 660 666 $request_path, 661 667 $repository->getVersionControlSystem()); 662 - $base_path = $info['path']; 668 + if ($info) { 669 + $base_path = $info['path']; 670 + } else { 671 + $base_path = ''; 672 + } 663 673 664 674 // For Git repositories, strip an optional directory component if it 665 675 // isn't the name of a known Git resource. This allows users to clone
+3
src/applications/repository/storage/PhabricatorRepository.php
··· 604 604 return "/R{$id}:{$identifier}"; 605 605 } 606 606 607 + /** 608 + * @return array|null 609 + */ 607 610 public static function parseRepositoryServicePath($request_path, $vcs) { 608 611 $is_git = ($vcs == PhabricatorRepositoryType::REPOSITORY_TYPE_GIT); 609 612