From f743ad920d16014d2e30e5614efa3da25c0b3fe6 Mon Sep 17 00:00:00 2001 From: JGZYES Date: Wed, 2 Sep 2026 22:04:53 +0800 Subject: [PATCH] git.php: local_asset also checks web root (install.sh) for release asset links --- web/git.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/git.php b/web/git.php index 2d4f18e..d715163 100644 --- a/web/git.php +++ b/web/git.php @@ -73,10 +73,12 @@ function gh_api(string $url): array { } /* Prefer a local copy of a release asset on this server; fall back to GitHub. */ function local_asset(string $name): ?string { - foreach ([__DIR__ . '/downloads/' . $name, __DIR__ . '/mirror/packages/pmm/' . $name] as $p) { + $cands = [__DIR__ . '/downloads/' . $name, __DIR__ . '/mirror/packages/pmm/' . $name, __DIR__ . '/' . $name]; + $base = realpath(__DIR__); + foreach ($cands as $p) { if (@is_file($p)) { - $base = realpath(__DIR__); - return '/' . str_replace('\\', '/', substr(str_replace('\\', '/', realpath($p)), strlen($base) + 1)); + $rp = realpath($p); + return '/' . str_replace('\\', '/', substr(str_replace('\\', '/', $rp), strlen($base) + 1)); } } return null;