diff --git a/main/webapp/modules/core/scripts/project/exporters.js b/main/webapp/modules/core/scripts/project/exporters.js index fb0c664fc..91dc00fa4 100644 --- a/main/webapp/modules/core/scripts/project/exporters.js +++ b/main/webapp/modules/core/scripts/project/exporters.js @@ -30,7 +30,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - function ExporterManager(button) { this._button = button; this._initializeUI(); @@ -117,6 +116,11 @@ ExporterManager.prototype._initializeUI = function() { }); }; +ExporterManager.stripNonFileChars = function(name) { + //prohibited characters in file name of linux (/) and windows (\/:*?"<>|) + return $.trim(name.replace(/[\\*\/:?"<>|]/g, ' ')).replace(/\s+/g, '-'); +}; + ExporterManager.handlers.exportTripleloader = function(format) { if (!theProject.overlayModels.freebaseProtograph) { alert($.i18n._('triple-loader')["warning-align"]); @@ -141,7 +145,7 @@ ExporterManager.handlers.exportRows = function(format, ext) { }; ExporterManager.prepareExportRowsForm = function(format, includeEngine, ext) { - var name = $.trim(theProject.metadata.name.replace(/\W/g, ' ')).replace(/\s+/g, '-'); + var name = ExporterManager.stripNonFileChars(theProject.metadata.name); var form = document.createElement("form"); $(form) .css("display", "none") @@ -168,7 +172,7 @@ ExporterManager.prepareExportRowsForm = function(format, includeEngine, ext) { }; ExporterManager.handlers.exportProject = function() { - var name = $.trim(theProject.metadata.name.replace(/\W/g, ' ')).replace(/\s+/g, '-'); + var name = ExporterManager.stripNonFileChars(theProject.metadata.name); // dialog var dialog = $(DOM.loadHTML("core", "scripts/dialogs/export-project-dialog.html")); var _elmts = DOM.bind(dialog); @@ -252,7 +256,7 @@ ExporterManager.handlers.exportProject = function() { ExporterManager.handlers.projectDataPackage = function() { function save(jsonMetadata) { - var name = $.trim(theProject.metadata.name.replace(/\W/g, ' ')).replace(/\s+/g, '-'); + var name = ExporterManager.stripNonFileChars(theProject.metadata.name); var form = document.createElement("form"); $(form) .css("display", "none")