fix(path): properly path encode &
| | |
| | | ["test.mp4", "test.mp4"], |
| | | ["note with spaces.md", "note-with-spaces"], |
| | | ["notes.with.dots.md", "notes.with.dots"], |
| | | ["test/special chars?.md", "test/special-chars-q"], |
| | | ["test/special chars?.md", "test/special-chars"], |
| | | ["test/special chars #3.md", "test/special-chars-3"], |
| | | ["cool/what about r&d?.md", "cool/what-about-r-and-d"], |
| | | ], |
| | | path.slugifyFilePath, |
| | | path.isFilePath, |
| | |
| | | return s |
| | | .split("/") |
| | | .map((segment) => |
| | | segment.replace(/\s/g, "-").replace(/%/g, "-percent").replace(/\?/g, "-q").replace(/#/g, ""), |
| | | segment |
| | | .replace(/\s/g, "-") |
| | | .replace(/&/g, "-and-") |
| | | .replace(/%/g, "-percent") |
| | | .replace(/\?/g, "") |
| | | .replace(/#/g, ""), |
| | | ) |
| | | .join("/") // always use / as sep |
| | | .replace(/\/$/, "") |