Add files via upload

This commit is contained in:
M.M.Azizi
2026-04-23 19:18:56 +03:30
committed by GitHub
parent 714eeea976
commit 61e84dd062
2 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -373,7 +373,7 @@ $phpExample = str_replace('{{BASE_URL}}', $baseUrl, $phpTemplate);
<footer>
<p>🛡️ Zero-Knowledge Architecture • Server cannot read your data</p>
<p class="footer-subtitle"></p>
<p class="footer-subtitle">API docs styled to match the main app.</p>
<div class="footer-links">
<a href="<?= h($homeUrl) ?>" title="Main app" aria-label="Main app">
<svg width="18" height="18" fill="currentColor" viewBox="0 0 24 24"><path d="M12 3 3 9v12h18V9l-9-6Zm0 2.2 7 4.67V19h-4v-5H9v5H5V9.87l7-4.67Z"/></svg>
+15 -1
View File
@@ -144,7 +144,7 @@ function normalizeRoutePath(string $path): string
}
$path = preg_replace('#/+#', '/', $path) ?: '/';
if ($path !== '/' && str_ends_with($path, '/')) {
if ($path !== '/' && routePathEndsWith($path, '/')) {
$path = rtrim($path, '/');
$path = $path === '' ? '/' : $path;
}
@@ -152,6 +152,20 @@ function normalizeRoutePath(string $path): string
return $path;
}
function routePathEndsWith(string $haystack, string $needle): bool
{
if ($needle === '') {
return true;
}
$needleLength = strlen($needle);
if ($needleLength > strlen($haystack)) {
return false;
}
return substr($haystack, -$needleLength) === $needle;
}
function sendCorsHeaders(): void
{
header('Access-Control-Allow-Origin: *');