From c2f0fbbb657b32e8209c26297e8b8dd8d88d5017 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Thu, 12 Oct 2023 00:06:09 -0700 Subject: [PATCH] fix: Properly handle files with whitespace --- doctoc.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doctoc.js b/doctoc.js index 578dfa9..f5c81db 100755 --- a/doctoc.js +++ b/doctoc.js @@ -12,8 +12,7 @@ var path = require('path') function cleanPath(path) { var homeExpanded = (path.indexOf('~') === 0) ? process.env.HOME + path.substr(1) : path; - // Escape all spaces - return homeExpanded.replace(/\s/g, '\\ '); + return homeExpanded; } function transformAndSave(files, mode, maxHeaderLevel, title, notitle, entryPrefix, processAll, stdOut, updateOnly) {