From 554609b625ad389a749537d8713dff057a7134ed Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 12 Feb 2018 12:07:47 +0100 Subject: [PATCH] fix gist deploy --- src/app/panels/file-panel.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index a597448bfa..51803bf3bf 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -269,6 +269,8 @@ function filepanel (appAPI, filesProvider) { modalDialogCustom.confirm(null, `Created a gist at ${data.html_url}. Would you like to open it in a new window?`, () => { window.open(data.html_url, '_blank') }) + } else { + modalDialogCustom.alert(data.message + ' ' + data.documentation_url) } } } @@ -322,15 +324,23 @@ function filepanel (appAPI, filesProvider) { } // return all the files, except the temporary/readonly ones.. -function packageFiles (files, callback) { +function packageFiles (filesProvider, callback) { var ret = {} - // @TODO remove use of `list()` - var filtered = Object.keys(files.list()).filter(function (path) { if (!files.isReadOnly(path)) { return path } }) - async.eachSeries(filtered, function (path, cb) { - ret[path.replace(files.type + '/', '')] = { content: files.get(path) } - cb() - }, () => { - callback(null, ret) + filesProvider.resolveDirectory('browser', (error, files) => { + if (error) callback(error) + else { + async.eachSeries(Object.keys(files), (path, cb) => { + filesProvider.get(path, (error, content) => { + if (error) cb(error) + else { + ret[path] = { content } + cb() + } + }) + }, (error) => { + callback(error, ret) + }) + } }) }