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

Colon in pattern causes crash or hanged process #94

Closed
SmashManiac opened this issue Aug 25, 2019 · 1 comment
Closed

Colon in pattern causes crash or hanged process #94

SmashManiac opened this issue Aug 25, 2019 · 1 comment
Labels
Milestone

Comments

@SmashManiac
Copy link

SmashManiac commented Aug 25, 2019

Describe the bug
When a colon appears in the metadata referenced by the pattern property, it causes Metalsmith to crash at best, or hang indefinitely at worse, depending on the length of the processed metadata.

Crash message example:

EINVAL: invalid argument, mkdir 'C:\permalinks-bug\build\:'] {
  errno: ←[33m-4071←[39m,
  code: ←[32m'EINVAL'←[39m,
  syscall: ←[32m'mkdir'←[39m,
  path: ←[32m'C:\\permalinks-bug\\build\\:'←[39m
}

To Reproduce
Steps to reproduce the behavior:

  1. Extract permalinks-bug.zip
  2. Run npm install
  3. Run node index

Expected behavior
Special characters in the permalink pattern metadata should be gracefully processed.

Environment

  • Windows 7 SP1
  • Node.js 12.9.0 (includes npm 6.10.2)
  • NTFS file system

Additional context
The issue was introduced in v2.0.0.

@webketje
Copy link
Member

Whether colon is a valid dir char depends on the OS. In Linux, colons are valid directory chars.
It seems highly unlikely that anyone would want a colon in their destination path, especially in the case of a static site.
Therefore the most straightforward solution would be to strip it

@webketje webketje added this to the 3.0.0 milestone Aug 4, 2022
@webketje webketje mentioned this issue Aug 4, 2022
6 tasks
webketje added a commit that referenced this issue Oct 16, 2023
…e sensible slugify defaults

This change sets more sensible slugify option defaults. As such it may result in different destination paths for existing builds.
To maintain compatibility, users should set slugify options to { lower: true, extend: {}, remove: /[^\w\s$*_+~.()'"!\-:@]+/g }.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants