From ba93421933b3fb156d2296f3f9efc2faed0cde1b Mon Sep 17 00:00:00 2001 From: Umberto Lentini Date: Sun, 6 Jan 2019 06:55:16 -0800 Subject: [PATCH] Fixed file paste (#3383) Fixes #3340 --- lib/components/term.js | 2 +- lib/utils/paste.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/components/term.js b/lib/components/term.js index d95429ec..16cd1fb4 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -189,7 +189,7 @@ export default class Term extends React.PureComponent { if (processed) { e.preventDefault(); e.stopPropagation(); - this.term.send(processed); + this.term._core.handler(processed); } } diff --git a/lib/utils/paste.js b/lib/utils/paste.js index 2f3eef04..a77b15ab 100644 --- a/lib/utils/paste.js +++ b/lib/utils/paste.js @@ -1,10 +1,16 @@ import {clipboard} from 'electron'; +import plist from 'plist'; const getPath = platform => { switch (platform) { case 'darwin': { - const filepath = clipboard.read('public.file-url'); - return filepath.replace('file://', ''); + if (clipboard.has('NSFilenamesPboardType')) { + // Parse plist file containing the path list of copied files + const list = plist.parse(clipboard.read('NSFilenamesPboardType')); + return "'" + list.join("' '") + "'"; + } else { + return null; + } } case 'win32': { const filepath = clipboard.read('FileNameW');