From f76bb0669118e67d626a7db55c778edd5329c0ad Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 8 Nov 2021 14:34:40 +0100 Subject: [PATCH] fix gists --- apps/remix-ide/src/app/files/fileManager.js | 30 +++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 4727635b88..eafdf326f9 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -749,23 +749,19 @@ class FileManager extends Plugin { }) await self.syncEditor(fileProvider + file) } else { - helper.createNonClashingName(file, self._deps.filesProviders[fileProvider], - async (error, name) => { - if (error) { - modalDialogCustom.alert('Unexpected error loading the file ' + error) - } else if (helper.checkSpecialChars(name)) { - modalDialogCustom.alert('Special characters are not allowed') - } else { - try { - console.log('set ', fileProvider, name, filesSet[file].content) - await self._deps.filesProviders[fileProvider].set(name, filesSet[file].content) - } catch (e) { - return callback(e.message || e) - } - await self.syncEditor(fileProvider + name) - } - callback() - }) + try { + const name = await helper.createNonClashingNameAsync(file, self) + if (helper.checkSpecialChars(name)) { + modalDialogCustom.alert('Special characters are not allowed') + } else { + await self._deps.filesProviders[fileProvider].set(name, filesSet[file].content) + await self.syncEditor(fileProvider + name) + } + } catch (error) { + modalDialogCustom.alert('Unexpected error loading the file ' + error) + return callback(error.message || error) + } + callback() } } }