diff --git a/core/language/en-GB/Import.multids b/core/language/en-GB/Import.multids index 083086606..3c7ced320 100644 --- a/core/language/en-GB/Import.multids +++ b/core/language/en-GB/Import.multids @@ -19,3 +19,4 @@ Upgrader/Plugins/Upgraded: Upgraded plugin from <> to <> Upgrader/State/Suppressed: Blocked temporary state tiddler Upgrader/System/Suppressed: Blocked system tiddler Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<>/> +Warning/Core: You are about importing risky tiddlers (<>). It is strongly recommend in the strongest terms NOT to use any hack that requires overwriting a core module, because it is likely to make the system unusable. Never import such tiddlers into an important wiki, just into a testing environment! diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 2bf0ac594..3109fdea9 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -485,7 +485,8 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) { // Import JSON tiddlers into a pending import tiddler NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) { // Get the tiddlers - var tiddlers = []; + var tiddlers = [], + warning = []; try { tiddlers = JSON.parse(event.param); } catch(e) { @@ -506,10 +507,26 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) { tiddlerFields.title = $tw.utils.trim(tiddlerFields.title); var title = tiddlerFields.title; if(title) { + if(title.indexOf('$:/core/') === 0) { + warning.push(title); + } incomingTiddlers.push(title); importData.tiddlers[title] = tiddlerFields; } }); + // Show warning about risky tiddlers + if(warning.length) { + var titles = []; + $tw.utils.each(warning,function(title) { + titles.push(title); + }); + var logger = new $tw.utils.Logger("import"); + logger.alert($tw.language.getString( + "Import/Warning/Core", + {variables: { + "titles": titles.join(", "), + }})); + } // Give the active upgrader modules a chance to process the incoming tiddlers var messages = this.wiki.invokeUpgraders(incomingTiddlers,importData.tiddlers); $tw.utils.each(messages,function(message,title) {