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

= is not allowed in path #4699

Open
mastorm opened this issue Sep 6, 2022 · 1 comment
Open

= is not allowed in path #4699

mastorm opened this issue Sep 6, 2022 · 1 comment

Comments

@mastorm
Copy link

mastorm commented Sep 6, 2022

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @graphql-tools/utils@8.10.1 for the project I'm working on.

In Sveltekit, the equals-sign is used for fragment matching. Its a valid character for a path :(

Here is the diff that solved my problem:

diff --git a/node_modules/@graphql-tools/utils/cjs/helpers.js b/node_modules/@graphql-tools/utils/cjs/helpers.js
index a4fe8e2..17ff3f3 100644
--- a/node_modules/@graphql-tools/utils/cjs/helpers.js
+++ b/node_modules/@graphql-tools/utils/cjs/helpers.js
@@ -25,7 +25,7 @@ function isDocumentString(str) {
     return false;
 }
 exports.isDocumentString = isDocumentString;
-const invalidPathRegex = /[‘“!%^<=>`]/;
+const invalidPathRegex = /[‘“!%^<>`]/;
 function isValidPath(str) {
     return typeof str === 'string' && !invalidPathRegex.test(str);
 }
diff --git a/node_modules/@graphql-tools/utils/esm/helpers.js b/node_modules/@graphql-tools/utils/esm/helpers.js
index d800f95..34d7243 100644
--- a/node_modules/@graphql-tools/utils/esm/helpers.js
+++ b/node_modules/@graphql-tools/utils/esm/helpers.js
@@ -20,7 +20,7 @@ export function isDocumentString(str) {
     catch (e) { }
     return false;
 }
-const invalidPathRegex = /[‘“!%^<=>`]/;
+const invalidPathRegex = /[‘“!%^<>`]/;
 export function isValidPath(str) {
     return typeof str === 'string' && !invalidPathRegex.test(str);
 }

This issue body was partially generated by patch-package.

@gterras
Copy link

gterras commented Oct 25, 2022

Thanks for this @mastorm

If an author take interest in this post: please note that sveltekit router does a subsequent usage of = sign
https://kit.svelte.dev/docs/advanced-routing#matching

Since = is a valid character in any modern filesystem could you consider removing it off the list?

Thanks

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

No branches or pull requests

2 participants