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

fix(server): support import paths with special chars #14856

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

etnoy
Copy link
Contributor

@etnoy etnoy commented Dec 22, 2024

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

@etnoy etnoy force-pushed the fix/asterisk-import-path branch from 68ffe33 to f7d628d Compare December 22, 2024 00:21
@@ -214,7 +214,7 @@ export class StorageRepository implements IStorageRepository {
}

private asGlob(pathToCrawl: string): string {
Copy link
Contributor

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?

Copy link
Contributor Author

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 ["]

@bo0tzz bo0tzz requested a review from mertalev December 22, 2024 10:17
@@ -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('`', '[`]');
Copy link
Member

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't crawl libraries with import paths containing quote symbols
4 participants