Simplifies path normalization for Windows compatibility

Avoids double normalization of paths, which can lead to issues with Windows path handling, specifically with drive letters and forward slashes.
This commit is contained in:
AlexKucera committed 2025-11-05 08:32:58 +01:00
1 parent c788422cdf
commit a9f436f972
1 file changed
+3 -4
+3 -4
View File
@@ -207,7 +207,7 @@ export class TempDirectoryManager {
// Use path.join to properly handle absolute paths // Use path.join to properly handle absolute paths
const result = path.join(pluginDir, dirName); const result = path.join(pluginDir, dirName);
return normalizePath(path.normalize(result)); return normalizePath(result);
} }
/** /**
@@ -442,10 +442,9 @@ export class TempDirectoryManager {
public isPluginTempDir(dirPath: string): boolean { public isPluginTempDir(dirPath: string): boolean {
const pluginDir = this.getPluginDir(); const pluginDir = this.getPluginDir();
const normalizedDirPath = normalizePath(dirPath); const normalizedDirPath = normalizePath(dirPath);
const normalizedPluginDir = normalizePath(pluginDir);
const tempImagesDir = normalizePath(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_IMAGES)); const tempImagesDir = normalizePath(path.join(pluginDir, PLUGIN_DIRS.TEMP_IMAGES));
const tempPandocDir = normalizePath(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_PANDOC)); const tempPandocDir = normalizePath(path.join(pluginDir, PLUGIN_DIRS.TEMP_PANDOC));
return normalizedDirPath.startsWith(tempImagesDir) || return normalizedDirPath.startsWith(tempImagesDir) ||
normalizedDirPath.startsWith(tempPandocDir); normalizedDirPath.startsWith(tempPandocDir);