| | $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 = |