Skip to content

Commit 6b8c06f

Browse files
committed
refactor(index.php): improve URI handling for self-update endpoint
- Updated the logic to parse the request URI and remove trailing slashes for consistent comparison. - Enhanced the condition to check for the '/self-update' path, improving code clarity and maintainability.
1 parent 4325b04 commit 6b8c06f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

public/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88

99
$container = (new ContainerProvider())->provide();
1010

11-
if ($_SERVER['REQUEST_URI'] === '/self-update') {
11+
// Parse the URI to get just the path (without query string)
12+
$requestPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
13+
// Remove trailing slash for consistent comparison (except for root)
14+
$requestPath = $requestPath !== '/' ? rtrim($requestPath, '/') : $requestPath;
15+
16+
if ($requestPath === '/self-update') {
1217
$output = runSelfUpdate();
1318
echo nl2br(htmlspecialchars($output, ENT_QUOTES, 'UTF-8'));
1419
} else {

0 commit comments

Comments
 (0)