Skip to content

Invalid CSS file name caused by brackets and + #5843

@eahrold

Description

@eahrold

Describe the bug

When a wild card route is used, and the application is build with the adapter-node the resulting .css file has square brackets in the file name which should be escaped.

This is not a problem with serving with node directly, however when proxied through some non-js routers the route is considered invalid, as per various specs. (i.e. I'm serving the node application in a docker container, and have a proxy server intercepting requests and forwarding them to the node server)

and if you pass the route through encodeURI it too escapes the brackets

encodeURI("http://localhost:3000/_app/immutable/assets/[...allRoutes]-b0a89eda.css")

// http://localhost:3000/_app/immutable/assets/%5B...allRoutes%5D-b0a89eda.css

Demo of the URL format when used in Java

Reproduction

https://github.com/eahrold/svelte-kit-invalid-css-path

The problem .css file is here
https://github.com/eahrold/svelte-kit-invalid-css-path/tree/main/build/client/_app/immutable/assets

The corresponding .js file works and looks to be processed differently.
https://github.com/eahrold/svelte-kit-invalid-css-path/tree/main/build/client/_app/immutable/pages

The browser request doesn't encode the url

invalid-route-used-directly

Logs

No response

System Info

System:
    OS: macOS 12.2
    CPU: (8) arm64 Apple M1
    Memory: 97.22 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.1/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
  Browsers:
    Chrome: 104.0.5112.79
    Firefox: 102.0.1
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-node: next => 1.0.0-next.85 
    @sveltejs/kit: next => 1.0.0-next.403 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^3.0.0 => 3.0.4

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvite

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions