From d0d96df17dfb1657247389dbb3b15fce37f8fe0f Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Mon, 4 Sep 2017 21:41:08 +0100 Subject: [PATCH] #12: Corrected the way redirects work on the gallery side due to an issue when trying out on a real system --- app/Http/Controllers/Gallery/AlbumController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Gallery/AlbumController.php b/app/Http/Controllers/Gallery/AlbumController.php index b705e1a..83909bb 100644 --- a/app/Http/Controllers/Gallery/AlbumController.php +++ b/app/Http/Controllers/Gallery/AlbumController.php @@ -22,8 +22,9 @@ class AlbumController extends Controller $album = DbHelper::getAlbumByPath($albumUrlAlias); if (is_null($album)) { - // Check redirects - $redirect = AlbumRedirect::where(DB::raw('\'/a\' + source_url'), $request->path())->first(); + // Check redirects (remove the first 'a' at the beginning - e.g. "a/Florida-2015" => "/Florida-2015" + $requestPath = preg_replace('/^a/', '', $request->path()); + $redirect = AlbumRedirect::where('source_url', $requestPath)->first(); if (is_null($redirect)) {