Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Fixes for streaming raw file

Author Dave Jarvis <email>
Date 2026-02-15 22:20:41 GMT-0800
Commit 8f40e2b94e7946b481544f1ea87d3b7c1cdfeeee
Parent af01231
Router.php
$parts = explode( '/', $uri );
- // FIX 1: Handle the optional 'repo' prefix
if( !empty($parts) && $parts[0] === 'repo' ) {
- array_shift( $parts );
+ array_shift( $parts );
}
if( empty( $parts ) || empty( $parts[0] ) ) {
return new HomePage( $this->repos, $this->git );
}
$repoName = array_shift( $parts );
- // FIX 2: Only route to ClonePage if it is NOT a UI action.
- // This prevents "treetrek.git/blob/..." from being hijacked by the clone logic.
$nextPart = $parts[0] ?? '';
$uiActions = ['tree', 'blob', 'raw', 'commits', 'commit', 'tags'];
- if( str_ends_with( $repoName, '.git' ) && !in_array( $nextPart, $uiActions ) ) {
+ if( str_ends_with( $repoName, '.git' ) &&
+ !in_array( $nextPart, $uiActions ) && !empty( $parts ) ) {
$realName = substr( $repoName, 0, -4 );
$isRealRepo =
git/Git.php
$fullPath = "{$this->repoPath}/$subPath";
- return file_exists( $fullPath )
+ return is_file( $fullPath )
? $this->streamIfPathValid( $fullPath )
: false;
Delta 4 lines added, 6 lines removed, 2-line decrease