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

Percent symbol (%) is classified as invalid path #6454

Open
3 of 4 tasks
ErgEnn opened this issue Aug 19, 2024 · 0 comments
Open
3 of 4 tasks

Percent symbol (%) is classified as invalid path #6454

ErgEnn opened this issue Aug 19, 2024 · 0 comments

Comments

@ErgEnn
Copy link

ErgEnn commented Aug 19, 2024

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug
When there is percent character anywhere in full path to code file (e.g. C:/dev/Repo%20Name/project/src/App.tsx) the codegen fails to analyze that file for graphql queries, since isValidPath classifies that path as invalid.

Such path commonly happens when repository name has whitespaces in it. The resulting git clone url has whitespaces replaced with URL encoded %20 tokens which git clone turns into directory name without URL decoding the repo name.

To Reproduce Steps to reproduce the behavior:

CodeSandbox

  1. Make project with graphql query in any code file that would normally be analyzed
  2. Alter the absolute path to have % sign in it at any leaf. (in example app src/invalid%20path/InvalidFile.ts)
  3. Run codegen and notice that document is not generated for that code file (in example app src/__generated__/gql.ts contains type definition only for query in ValidFile.ts, but not InvalidFile.ts)

Expected behavior

Documents should still be generated when they contain valid character like %.
Alternatively warning could be displayed when such failure occurs.

Environment:

  • OS: Windows
  • NodeJS: 20.11.0
  • @graphql-codegen/cli version: 5.0.2

Additional context

Related bugs:
#4699
dotansimha/graphql-code-generator#7959

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

1 participant