From fcbefa62caf8e0fa46ea28615f37db0c9e06068a Mon Sep 17 00:00:00 2001 From: yaofeng Date: Sat, 14 Jul 2018 13:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E6=96=87=E9=97=AE=E9=A2=98=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ElectronNET.API/Dialog.cs | 9 ++++++++- ElectronNET.API/ElectronNET.API.csproj | 5 +++-- ElectronNET.CLI/ElectronNET.CLI.csproj | 2 +- ElectronNET.Host/api/dialog.js | 10 ++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ElectronNET.API/Dialog.cs b/ElectronNET.API/Dialog.cs index cb5b520..1398483 100644 --- a/ElectronNET.API/Dialog.cs +++ b/ElectronNET.API/Dialog.cs @@ -3,7 +3,9 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using System; +using System.Collections.Generic; using System.Threading.Tasks; +using System.Web; namespace ElectronNET.API { @@ -54,7 +56,12 @@ namespace ElectronNET.API BridgeConnector.Socket.Off("showOpenDialogComplete" + guid); var result = ((JArray)filePaths).ToObject(); - taskCompletionSource.SetResult(result); + var list = new List(); + foreach (var item in result) + { + list.Add(HttpUtility.UrlDecode(item)); + } + taskCompletionSource.SetResult(list.ToArray()); }); diff --git a/ElectronNET.API/ElectronNET.API.csproj b/ElectronNET.API/ElectronNET.API.csproj index 236fb00..00eac8c 100644 --- a/ElectronNET.API/ElectronNET.API.csproj +++ b/ElectronNET.API/ElectronNET.API.csproj @@ -16,7 +16,7 @@ This package contains the API to access the "native" electron API. electron aspnetcore Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png - 1.0.1 + 1.0.0.2 @@ -32,8 +32,9 @@ This package contains the API to access the "native" electron API. + - + diff --git a/ElectronNET.CLI/ElectronNET.CLI.csproj b/ElectronNET.CLI/ElectronNET.CLI.csproj index 0867fb6..758973a 100644 --- a/ElectronNET.CLI/ElectronNET.CLI.csproj +++ b/ElectronNET.CLI/ElectronNET.CLI.csproj @@ -9,7 +9,7 @@ true ..\artifacts ElectronNET.CLI - 1.0.4 + 1.0.4.1 Gregor Biswanger, Robert Muehsig Electron.NET diff --git a/ElectronNET.Host/api/dialog.js b/ElectronNET.Host/api/dialog.js index 4d93400..0e762ff 100644 --- a/ElectronNET.Host/api/dialog.js +++ b/ElectronNET.Host/api/dialog.js @@ -20,13 +20,19 @@ module.exports = function (socket) { socket.on('showOpenDialog', function (browserWindow, options, guid) { var window = electron_1.BrowserWindow.fromId(browserWindow.id); electron_1.dialog.showOpenDialog(window, options, function (filePaths) { - global.elesocket.emit('showOpenDialogComplete' + guid, filePaths || []); + filePaths = filePaths || []; + var encodeFilePaths = []; + filePaths.forEach((item, index) => { + encodeFilePaths.push(encodeURIComponent(item)); + }); + global.elesocket.emit('showOpenDialogComplete' + guid, encodeFilePaths); }); }); socket.on('showSaveDialog', function (browserWindow, options, guid) { var window = electron_1.BrowserWindow.fromId(browserWindow.id); electron_1.dialog.showSaveDialog(window, options, function (filename) { - global.elesocket.emit('showSaveDialogComplete' + guid, filename || ''); + filename = encodeURIComponent(filename || ''); + global.elesocket.emit('showSaveDialogComplete' + guid, filename); }); }); socket.on('showErrorBox', function (title, content) {