-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(server): support import paths with special chars #14856
Conversation
68ffe33
to
f7d628d
Compare
@@ -214,7 +214,7 @@ export class StorageRepository implements IStorageRepository { | |||
} | |||
|
|||
private asGlob(pathToCrawl: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is there a square bracket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Around the special characters? Turns out, that's how you escape double quotes, single quotes and asterisks when using a dynamic glob pattern. A literal " is written as ["]
@@ -214,7 +214,7 @@ export class StorageRepository implements IStorageRepository { | |||
} | |||
|
|||
private asGlob(pathToCrawl: string): string { | |||
const escapedPath = escapePath(pathToCrawl); | |||
const escapedPath = escapePath(pathToCrawl).replaceAll('"', '["]').replaceAll("'", "[']").replaceAll('`', '[`]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so freaking annoying that there isn't just a library escapePath
function that does it all...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We uncover all kinds of bugs in libraries, I should probably file this as an issue with fast-glob. Likely we are the first ones to even notice
Fixes #14588
It was not possible to have an import path with apostrope, double quote, asterisk and so on. Now it works.
Also adds support for several other special characters, except for backslash which seems like a special category of difficult