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

Sanitize "." in sanitizedPaths #403

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Snapstromegon
Copy link

@Snapstromegon Snapstromegon commented Dec 12, 2021

Problem:
If the title of an entry contains a ".", the path becomes invalid.

Solution:
Replacing all "."s in the path using slugify resolves this problem.

Furthermore the following changes got made to simplify the code of sanitizePath:

  • Slugify automatically removes leading, trailing or doubled replacement chars, so doing it explicitly is just a no-op.
  • Also slugify has an option for converting to lower case.

Snapstromegon and others added 5 commits December 12, 2021 20:54
Problem:
If the title of an entry contains a ".", the path becomes invalid.

Solution:
Removing all "."s in the path using slugify resolves this problem.

Furthermore the following changes got made to simplify the code of sanitizePath:
- Slugify automatically removes leading, trailing or doubled replacement chars, so doing it explicitly is just a no-op.
- Also slugify has an option for converting to lower case.
Signed-off-by: Raphael Höser <raphael@hoeser.info>
Signed-off-by: Raphael Höser <raphael@hoeser.info>
…efault char set

Change the bahavior to replace dots instead of removing them

Signed-off-by: Raphael Höser <raphael@hoeser.info>
@Snapstromegon Snapstromegon changed the title Remove "." from sanitizedPaths Sanitize "." in sanitizedPaths Dec 12, 2021
My solution was using replaceAll, but that isn't supported in node 12.
Therefore I switched to regex for this.
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

Successfully merging this pull request may close these issues.

None yet

1 participant