What happened?
Description
If serving files in local directory, router.php does not serve files with umlauts.
Steps to reproduce
- Create an asset with umlauts, for example hellö.png
- router.php tries to serve a file named hell%C3%96.png
Expected behavior
File should be served from file system
Actual behavior
File is not found in the file system
Fix (use urldecode):
4,6c4,6
< $parts = parse_url($_SERVER['REQUEST_URI'] ?? '');
< if (!empty($parts['path'])) {
< if (realpath($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $parts['path'])) {
---
> $path = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH);
> if (!empty($path)) {
> if (realpath($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . urldecode($path))) {
Craft CMS version
4.x, 5.x
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
What happened?
Description
If serving files in local directory, router.php does not serve files with umlauts.
Steps to reproduce
Expected behavior
File should be served from file system
Actual behavior
File is not found in the file system
Fix (use urldecode):
Craft CMS version
4.x, 5.x
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions