Skip to content

Commit

Permalink
Convert incoming urls in Redirects middleware to ascii (for special c…
Browse files Browse the repository at this point in the history
…haracters)
  • Loading branch information
kjellkeisse committed Dec 5, 2023
1 parent b6d1c2b commit 290581a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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).

## v0.1.4 - 2023-12-05

### What's Changed

- Convert incoming urls in Redirects middleware to ascii (for special characters)

## v0.1.3 - 2023-11-27

### What's Changed
Expand Down
5 changes: 5 additions & 0 deletions src/Http/Middleware/Redirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ public function handle(Request $request, Closure $next)
->get();
});

// Decode urls
$uri = urldecode($request->getUri());
$requestUri = urldecode($request->getRequestUri());

// Convert to ascii (for special characters)
$uri = Str::ascii($uri);
$requestUri = Str::ascii($requestUri);

$current = [
'full' => $uri,
'fullNoQuery' => Str::beforeLast($uri, '?'),
Expand Down

0 comments on commit 290581a

Please sign in to comment.