Skip to content

Commit

Permalink
urldecode uri in redirects middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellkeisse committed Nov 27, 2023
1 parent 54e2996 commit b6d1c2b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

11 changes: 7 additions & 4 deletions src/Http/Middleware/Redirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b6d1c2b

Please sign in to comment.