From b6d1c2b6a8308141fee8c037d052170bb380a869 Mon Sep 17 00:00:00 2001 From: Kjell Keisse Date: Mon, 27 Nov 2023 17:59:10 +0100 Subject: [PATCH] urldecode uri in redirects middleware --- CHANGELOG.md | 13 ++++++++++++- src/Http/Middleware/Redirects.php | 11 +++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d94e3d6..f84083c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,4 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## v0.1.3 - 2023-11-27 + +### What's Changed + +- urldecode uri in redirects middleware + +## v0.1.2 - 2023-11-27 + +### What's Changed + +- Trim cleanFrom attribute + diff --git a/src/Http/Middleware/Redirects.php b/src/Http/Middleware/Redirects.php index 2fb3dee..5185c82 100644 --- a/src/Http/Middleware/Redirects.php +++ b/src/Http/Middleware/Redirects.php @@ -22,11 +22,14 @@ public function handle(Request $request, Closure $next) ->get(); }); + $uri = urldecode($request->getUri()); + $requestUri = urldecode($request->getRequestUri()); + $current = [ - 'full' => $request->getUri(), - 'fullNoQuery' => Str::beforeLast($request->getUri(), '?'), - 'path' => $request->getRequestUri(), - 'pathNoQuery' => Str::beforeLast($request->getRequestUri(), '?'), + 'full' => $uri, + 'fullNoQuery' => Str::beforeLast($uri, '?'), + 'path' => $requestUri, + 'pathNoQuery' => Str::beforeLast($requestUri, '?'), ]; $activeRedirect = $urlMaps->first(function ($redirect) use ($current) {