denoland/fresh

In fresh 2.0 static file path components aren't decoded

felix-schindler opened this issue · 0 comments

This is only a problem in Fresh 2.0. In version 1.x everything works as expected

Summary

The static file middleware is not functioning correctly because it fails to decode path components. This results in problems when accessing files and directories with names containing special characters or encoded elements.

Examples of problematic file and directory names include:

  • C#.svg
  • 西安.avif
  • 제주도

Steps to Reproduce

  1. Place files with these names in the static file directory.
  2. Configure the static file middleware to serve files from this directory.
  3. Attempt to access these files via their URLs.
  • /C%23.svg
  • /%E8%A5%BF%E5%AE%89.avif
  • /%EC%A0%9C%EC%A3%BC%EB%8F%84/sth.txt

Expected behaviour

The middleware should decode the URL-encoded path components and correctly serve the requested files:

  • /static/C#.svg
  • /static/西安.avif
  • /static/제주도/sth.txt

Actual Behavior

The middleware does not decode the path components, resulting in 404 errors.

Environment

  • @fresh/core@2.0.0-alpha.19
  • deno 1.45.5
  • macos 14.6 (arm64)