fix #1578 enable export with filename composed of non-alphanumerical characters
This commit is contained in:
parent
3c4002ee2c
commit
38877f1449
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user