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

[Bug]: Storybook unable to locate stories when special characters are used in path to working directory in v.7.0.0-rc3. #21636

Closed
unitario opened this issue Mar 16, 2023 · 5 comments · Fixed by #22110

Comments

@unitario
Copy link

Describe the bug

If the path to Storybook contains special characters the glob lookup fails with a warning saying that no story could be found using pattern.

The problem is the concatenation of of the fullGlob which include the working directory:

const fullGlob = slash(
path.join(this.options.workingDir, specifier.directory, specifier.files)
);

That means if there are special characters in that path like parenthesis those will be processed as a glob pattern:

const files = await glob(fullGlob);

Possible solution could be by changing this:

  const fullGlob = slash(
    path.join(this.options.workingDir, specifier.directory, specifier.files)
  );
  const files = await glob(fullGlob);

To this:

  const fullGlob = slash(
    path.join(specifier.directory, specifier.files)
  );
  const files = await glob(fullGlob, { cwd: this.options.workingDir });

I have monkey patched it and works fine.

To Reproduce

Put Storybook in a working directory that contains special characters like /Users/User/Special (1)/ and serve Storybook.

System

Environment Info:

  System:
    OS: macOS 13.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 3.2.2 - /usr/local/bin/yarn
    npm: 8.12.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Safari: 16.3

Additional context

No response

@unitario unitario changed the title [Bug]: Special characters in is causing issues when service Storybook [Bug]: Storybook unable to locate stories when special characters are used in path to working directory Mar 17, 2023
@unitario unitario changed the title [Bug]: Storybook unable to locate stories when special characters are used in path to working directory [Bug]: Storybook unable to locate stories when special characters are used in path to working directory in v.7.0.0-rc3. Mar 17, 2023
@shilman shilman added core and removed needs triage labels Mar 19, 2023
@shilman
Copy link
Member

shilman commented Mar 19, 2023

@unitario thanks for filing & coming up with a potential fix. any chance you can submit a PR? we can give it a thorough test before merging. 🙏

@unitario
Copy link
Author

@shilman I could but it might take while (one or two weeks due to traveling). I suggest you label this "good first issues" and if no takers then I'll look into it at when available?

@shilman
Copy link
Member

shilman commented Mar 19, 2023

Ok we'll probably take this one then to get it out as part of 7.0. Thanks for letting me know!

@shilman
Copy link
Member

shilman commented Mar 21, 2023

@caiotracera that would be wonderful! 🙏 Please check out how to contribute in our docs and feel free to ask questions in #contributing in our Discord.

@caiotracera caiotracera removed their assignment Mar 28, 2023
@jankoritak
Copy link
Contributor

jankoritak commented Apr 12, 2023

I can grab this. Feel free to assign me, @shilman. 😊

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

Successfully merging a pull request may close this issue.

5 participants