Skip to content

Fix UTF-8 and URL-encoded static file handling in Controller#381

Open
apapacy wants to merge 2 commits into
novaframework:masterfrom
apapacy:fix-static-files-urlencoded-and-utf8-path
Open

Fix UTF-8 and URL-encoded static file handling in Controller#381
apapacy wants to merge 2 commits into
novaframework:masterfrom
apapacy:fix-static-files-urlencoded-and-utf8-path

Conversation

@apapacy
Copy link
Copy Markdown

@apapacy apapacy commented May 10, 2026

Pull Request: Fix UTF-8 and URL-encoded static file handling in Controller

Description

This PR addresses an issue where the Controller module failed to correctly process static files with UTF-8 characters or URL-encoded names. Previously, requesting files with special characters or non-ASCII names resulted in 404 Not Found errors or incorrect file resolution.

Changes

  • Decoded Request Paths: Added logic to properly decode URL-encoded strings before file lookups.
  • UTF-8 Support: Updated the file handling middleware/method to support multi-byte character sets.
  • Sanitization: Improved path normalization to ensure compatibility across different filesystems.

How to test

  1. Upload a static file with a name containing spaces or non-Latin characters (e.g., тест файл.png or café.jpg).
  2. Attempt to access the file via its URL.
  3. Verify that the file is served correctly with a 200 OK status.

Короткий варіант (якщо потрібен лише опис одним абзацом):

Fix: Support UTF-8 and URL-encoded static filenames
Resolved an issue in the Controller module where static files with UTF-8 characters or URL-encoded names were not being handled correctly. This PR implements proper decoding and character support to ensure all static assets are served reliably regardless of their naming convention.

@apapacy apapacy requested a review from Taure as a code owner May 10, 2026 19:43
Copy link
Copy Markdown
Collaborator

@Taure Taure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR.

I will look more into it, but first look I could see a security issue. the url decoding could make %2E%2E and that .. and we accidently can escape priv directory. I see that our nova_router doesn't have url decode and I will have a look at it and we maybe can solve it before we reach the controller and in that case we don't need that part.

@apapacy
Copy link
Copy Markdown
Author

apapacy commented May 11, 2026

Thanks, that would be great. By the way, the controller itself allows you to go beyond its folder and in its current state. Another thing is that urls with real dots are cut off somewhere at the previous stage and will not get into the controller. And after the changes they will get into it.
зображення

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants