fix: directory special characters not removed

This commit is contained in:
2024-06-16 11:19:46 +02:00
parent dcb63f5f29
commit 379b2e7f0b
4 changed files with 5 additions and 2 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -5,6 +5,7 @@ import { parseArgs } from 'util'
import { argsSchema } from "./utils/types/schema";
import removeLastSlash from "./utils/removeLastSlash";
import getAverage from './utils/getAverage';
import removeDirSpecialCharacters from './utils/removeDirSpecialCharacters';
const { values } = parseArgs({
args: Bun.argv,
@@ -48,7 +49,7 @@ for (const event of events) {
const initialWritePerf = performance.now()
await Bun.write(`${removeLastSlash(parsedValues.data.out)}/${event.fileName}`, event.frontmatterContent)
await Bun.write(`${removeLastSlash(parsedValues.data.out)}/${removeDirSpecialCharacters(event.fileName)}`, event.frontmatterContent)
const finalWritePerf = performance.now()
writePerfArray.push(finalWritePerf - initialWritePerf)

View File

@@ -14,7 +14,6 @@
"dependencies": {
"ical.js": "^2.0.1",
"luxon": "^3.4.4",
"node-ical": "^0.18.0",
"rrule": "^2.8.1",
"zod": "^3.23.8"
}

View File

@@ -0,0 +1,3 @@
export default function removeDirSpecialCharacters(dir: string): string {
return dir.replace(/[\\/:*?"<>|º]/g, '');
}