-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Describe the bug
utils.js:105 Uncaught (in promise) Error: Invalid path soMe-Name-with_hyphens
at split_path (utils.js:105:9)
at convert_formdata (utils.js:92:20)
at handle_submit (form.svelte.js:58:17)
at HTMLFormElement.<anonymous> (form.svelte.js:239:11)
split_path @ utils.js:105
convert_formdata @ utils.js:92
handle_submit @ form.svelte.js:58
(anonymous) @ form.svelte.js:239
kit/packages/kit/src/runtime/utils.js
Line 98 in b5000df
const path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/; |
This regex would fix the issue (though may cause other issues, I haven't fully looked into what the library is doing).
const path_regex = /^[a-zA-Z_$][\w-]*(\.[a-zA-Z_$][\w-]*|\[\d+\])*$/;
Reproduction
Logs
System Info
System:
OS: macOS 15.6.1
CPU: (12) arm64 Apple M2 Max
Memory: 123.25 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.20.0 - ~/.volta/tools/image/node/22.20.0/bin/node
Yarn: 4.10.3 - ~/.volta/tools/image/yarn/4.10.3/bin/yarn
npm: 11.6.1 - ~/.volta/tools/image/npm/11.6.1/bin/npm
bun: 1.2.0 - ~/.volta/bin/bun
Browsers:
Brave Browser: 121.1.62.156
Edge: 140.0.3485.94
Safari: 26.0.1
npmPackages:
@sveltejs/adapter-node: ^5.3.2 => 5.3.2
@sveltejs/enhanced-img: ^0.8.2 => 0.8.2
@sveltejs/kit: 2.43.5 => 2.43.5
@sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
svelte: 5.39.6 => 5.39.6
vite: 7.1.7 => 7.1.7
Severity
serious, but I can work around it
Additional Information
Form fields with hyphens are valid HTML (I believe). Using regex to test and cause a runtime failue seems wrong, though may be a limitation within svelte. If it is a (somewhat intentional) svelte limitation though, it should be caught in the compiler or linter.
Metadata
Metadata
Assignees
Labels
No labels