From 60cde22292e563ce3dbff80b25526103db2ef6b2 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 17 Oct 2018 16:25:15 -0400 Subject: [PATCH] Escape windows paths differently (Fixes #1217) --- packages/insomnia-app/app/plugins/install.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/insomnia-app/app/plugins/install.js b/packages/insomnia-app/app/plugins/install.js index b13791a46b..c3bd3faba1 100644 --- a/packages/insomnia-app/app/plugins/install.js +++ b/packages/insomnia-app/app/plugins/install.js @@ -3,7 +3,7 @@ import * as electron from 'electron'; import fs from 'fs'; import fsx from 'fs-extra'; import childProcess from 'child_process'; -import { getTempDir, isDevelopment, PLUGIN_PATH } from '../common/constants'; +import { getTempDir, isDevelopment, isWindows, PLUGIN_PATH } from '../common/constants'; import mkdirp from 'mkdirp'; import path from 'path'; @@ -177,5 +177,11 @@ function _getYarnPath() { } function escape(p) { - return p.replace(/(\s+)/g, '\\$1'); + if (isWindows()) { + // Quote for Windows paths + return `"${p}"`; + } else { + // Escape with backslashes for Unix paths + return p.replace(/(\s+)/g, '\\$1'); + } }