]> BookStack Code Mirror - devops/commitdiff
Update tinker-scripts/find-broken-internal-references.php main
authordanb <redacted>
Tue, 15 Jul 2025 11:50:11 +0000 (13:50 +0200)
committerdanb <redacted>
Tue, 15 Jul 2025 11:50:11 +0000 (13:50 +0200)
tinker-scripts/find-broken-internal-references.php

index a35a091443e6b8dd34d7638a2f2e60f585473c29..e1f9d4ce7c6b8a4e084a0b7a082672546a5eb297 100644 (file)
@@ -62,13 +62,13 @@ function linkTargetExists(string $link): bool|null
     }
 
     // Book
-    $bookMatch = preg_match('/\/books\/(.+?)\/([\/?#\s$]|$)/i', $link, $matches);
+    $bookMatch = preg_match('/\/books\/(.+?)([\/?#\s$]|$)/i', $link, $matches);
     if ($bookMatch) {
         return Book::query()->where('slug', '=', $matches[1])->exists();
     }
 
     // Shelf
-    $shelfMatch = preg_match('/\/shelves\/(.*?)\/([\/?#\s$]|$)/i', $link, $matches);
+    $shelfMatch = preg_match('/\/shelves\/(.*?)([\/?#\s$]|$)/i', $link, $matches);
     if ($shelfMatch) {
         return Bookshelf::query()->where('slug', '=', $matches[1])->exists();
     }