]> BookStack Code Mirror - bookstack/commitdiff
Fixed bad /api docs redirection on sub path
authorDan Brown <redacted>
Mon, 29 May 2023 13:41:59 +0000 (14:41 +0100)
committerDan Brown <redacted>
Mon, 29 May 2023 13:41:59 +0000 (14:41 +0100)
Direct route redirect does not seem to go via standard URL generator so
misses off generation via base URL.

app/Api/ApiDocsController.php
routes/web.php

index 020c8902f32a19a7d0ef5a896c78874ca10c5eb1..382ec15ebf4f5cfc55be8797f2ce3a8d16646fc0 100644 (file)
@@ -28,4 +28,12 @@ class ApiDocsController extends ApiController
 
         return response()->json($docs);
     }
+
+    /**
+     * Redirect to the API docs page.
+     */
+    public function redirect()
+    {
+        return redirect('/api/docs');
+    }
 }
index 48f6c27ba830aea57a56f048fae7c34156893cbc..468c300ba190eeafdfef7fdd36a06ea3ca6f9876 100644 (file)
@@ -29,7 +29,7 @@ Route::middleware('auth')->group(function () {
         ->where('path', '.*$');
 
     // API docs routes
-    Route::redirect('/api', '/api/docs');
+    Route::get('/api', [ApiDocsController::class, 'redirect']);
     Route::get('/api/docs', [ApiDocsController::class, 'display']);
 
     Route::get('/pages/recently-updated', [EntityControllers\PageController::class, 'showRecentlyUpdated']);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.