Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routes with %40 not working #5029

Closed
half2me opened this issue May 22, 2022 · 3 comments · Fixed by #5056
Closed

routes with %40 not working #5029

half2me opened this issue May 22, 2022 · 3 comments · Fixed by #5056
Labels
bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
Milestone

Comments

@half2me
Copy link
Contributor

half2me commented May 22, 2022

Describe the bug

I have a route like this: /@[username].
Up until recently, I just used the @ character as the name of the folder.
With the introduction of named layouts, I've had to get rid of the @ character as it was failing to build, and as someone on Discord suggested, I changed it to %40. This worked fine locally, and all my tests passed so I made the change.

However, when actually deployed to cloudflare pages with the cloudflare adapter, it fails to fetch any .js files under that path. It returns an http 200, but empty content. The page usually fails either due to mimetype checks, or some other error depending on the browser.

Failed to fetch dynamically imported module: https://<mysite>/_app/pages/%40_username_/index.svelte-71303df9.js

Reproduction

Using the cloudflare adapter, use a route with %40 somewhere in the path.

Logs

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "null". Strict MIME type checking is enforced for module scripts per HTML spec.

System Info

System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 626.66 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.1.0 - /opt/homebrew/bin/node
    npm: 8.8.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Safari: 15.4
  npmPackages:
    @sveltejs/adapter-cloudflare: next => 1.0.0-next.19 
    @sveltejs/kit: next => 1.0.0-next.338 
    svelte: ^3.46.0 => 3.48.0

Severity

blocking an upgrade

Additional Information

No response

@mrkishi mrkishi added bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc. pkg:adapter-cloudflare labels May 22, 2022
@mrkishi mrkishi added this to the 1.0 milestone May 22, 2022
@n-pn
Copy link

n-pn commented May 23, 2022

This also happens with node adapter, not only cloudflare adapter.
Related issue: #4403

@Rich-Harris
Copy link
Member

Would love to see a repro of this, because I can't get a route with %40 in the filename to work at all — not in dev, not in preview.

A workaround in the meantime would be to do something like src/routes/[username=prefixed] where prefixed is a matcher that verifies the username begins with @. It would then be part of the parameter, but that should be easy to accommodate.

@half2me
Copy link
Contributor Author

half2me commented May 24, 2022

Thanks for the suggestion @Rich-Harris . The %40 is not in the file's name, but the directory.
My file structure was /@[username]/index.svelte and that worked fine for me in dev locally.

@Rich-Harris Rich-Harris changed the title [adapter-cloudflare] routes with %40 not working routes with %40 not working May 24, 2022
Rich-Harris added a commit that referenced this issue Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants