| | $action = $_GET['action'] ?? 'file'; |
| | $hash = $this->sanitize( $_GET['hash'] ?? '' ); |
| | + $subPath = ''; |
| | + |
| | + $uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); |
| | + $scriptName = $_SERVER['SCRIPT_NAME']; |
| | + |
| | + if ( strpos( $uri, $scriptName ) === 0 ) { |
| | + $uri = substr( $uri, strlen( $scriptName ) ); |
| | + } |
| | + |
| | + if( preg_match( '#^/([^/]+)\.git(?:/(.*))?$#', $uri, $matches ) ) { |
| | + $reqRepo = urldecode( $matches[1] ); |
| | + $subPath = isset( $matches[2] ) ? ltrim( $matches[2], '/' ) : ''; |
| | + $action = 'clone'; |
| | + } |
| | |
| | $currRepo = null; |
| | - $subPath = ''; |
| | $decoded = urldecode( $reqRepo ); |
| | |