Skip to content

404 if static/ filename contains % #11371

@Timer

Description

@Timer

Bug report

Describe the bug

Static assets served from the static/ folder will 404 if they contain URL-encodable symbols.

Note: This issue is identical to #10004, but pertains to the static/ folder instead of the public/ folder.

To Reproduce

  1. Create a new Next.js Application
    yarn create next-app test-static
    cd test-static
    
  2. Create a static file with a unique name:
    mkdir static/
    echo "hello world" > static/hello%20copy.txt
    
  3. Start the development server and issue a request for the file:
    yarn dev
    curl http://localhost:3000/static/hello%2520copy.txt
    
  4. See a 404 instead of file contents.

Expected behavior

Running the following:

curl http://localhost:3000/static/hello%2520copy.txt

Should respond with the file contents, not a 404.

Screenshots

image

System information

  • OS: macOS
  • Version of Next.js: 9.3.2

Additional Context

Related issue: #9705
Related PR: #10022

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions