Skip to content

fix: update regex to allow whitespace & + in Windows path - #74

Merged
haoqunjiang merged 4 commits into
vitejs:masterfrom
MauriceChocoSwiss:patch-1
Aug 5, 2024
Merged

haoqunjiang merged 4 commits into
vitejs:masterfrom
MauriceChocoSwiss:patch-1

Conversation

@MauriceChocoSwiss

@MauriceChocoSwiss MauriceChocoSwiss commented Jul 24, 2024 •

Copy link
Copy Markdown
Contributor

Updated regex to authorize whitespace in file path.

Many projects has a whitespace in folder name (like me). Many time it doesn't affect anything but here it prevent file to open.

Let me know !

@ghost

ghost commented Jul 29, 2024

Copy link
Copy Markdown

Hey,

would you be interested in adding + as well? Thats used by sveltekit ( see #50 (comment) ) and sveltejs/vite-plugin-svelte#943

cc @sodatea this would be the "expand allow list" i mentioned, might be a stop-gap solution until you find the time to implement propper escaping.

@MauriceChocoSwiss

Copy link
Copy Markdown
Contributor Author

Why not, I didn't use sveltkit but I think it can be good for sveltkit user.

Comment thread packages/launch-editor/index.js Resolved
Comment thread packages/launch-editor/index.js Resolved
@ghost

ghost commented Jul 30, 2024

Copy link
Copy Markdown

i wonder if you want \s or an actual space char in that group

MauriceChocoSwiss and others added 2 commits July 30, 2024 14:37
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
@MauriceChocoSwiss

MauriceChocoSwiss commented Jul 30, 2024 •

Copy link
Copy Markdown
Contributor Author

I prefer to use the \s, it cover more cases like tabs, line breaks etc... In case of ^^

@ghost

ghost commented Aug 1, 2024

Copy link
Copy Markdown

is it possible to have line breaks or tabs in a file path on windows? (that file system never fails to impress, just not sure if in a positive way)

@MauriceChocoSwiss

Copy link
Copy Markdown
Contributor Author

I really don't know... You prefer to use only spaces ?

@ghost

ghost commented Aug 1, 2024

Copy link
Copy Markdown

unless they are possible/allowed, i would prefer just space, but maybe @sodatea has a different opinion.

It would be good to get this merged soonish so we can include it in vite 5.5.

@haoqunjiang
haoqunjiang merged commit 9779c46 into vitejs:master Aug 5, 2024
@haoqunjiang haoqunjiang changed the title Update regex to authorize whitespace in path fix: update regex to allow whitespace & + in Windows path Aug 5, 2024
@haoqunjiang

Copy link
Copy Markdown
Member

According to https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file CR, LF and TABs are not allowed in a file path. So I think a single space character should suffice.

@haoqunjiang

Copy link
Copy Markdown
Member

As for other special characters, there seem to be many more to add for compatibility with all the popular filesystem-based routing solutions, but I'll leave that to a later PR.

@oneezy

oneezy commented Aug 24, 2024 •

Copy link
Copy Markdown

As for other special characters, there seem to be many more to add for compatibility with all the popular filesystem-based routing solutions, but I'll leave that to a later PR.

yeahh @sodatea it's still an issue on Win11

Reference

issue: sveltejs/vite-plugin-svelte#943 (comment)

@Loizzus

Loizzus commented Aug 26, 2024

Copy link
Copy Markdown

I don't think banning characters is the solution to this problem. Even if you did find all the characters that are currently used by every system that depends on Vite why prevent some creative new use of valid special characters in the future? This entire feature seems very short sighted.

haoqunjiang added a commit to haoqunjiang/launch-editor that referenced this pull request Sep 4, 2024
haoqunjiang added a commit to haoqunjiang/launch-editor that referenced this pull request Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants