summaryrefslogtreecommitdiffstats
path: root/src/file.cpp
diff options
context:
space:
mode:
authorChristophe Lebras <christophe.lebras@gmail.com>2018-08-27 13:39:03 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2018-08-27 13:39:03 +0000
commitda46521af28c87bbe29ed35891fe92a1efa8e85e (patch)
treebbe531b0f5b8e34de32051457b459d58f69c346b /src/file.cpp
parentEnable autosaves by default, puts them in user cache dir (diff)
downloadinkscape-da46521af28c87bbe29ed35891fe92a1efa8e85e.tar.gz
inkscape-da46521af28c87bbe29ed35891fe92a1efa8e85e.zip
Fix bug 1789010 - Sanitize template's file name
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/file.cpp b/src/file.cpp
index 48b9ee467..d32d104ac 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -73,7 +73,6 @@
#include "xml/rebase-hrefs.h"
#include "xml/sp-css-attr.h"
-
using Inkscape::DocumentUndo;
using Inkscape::IO::Resource::TEMPLATES;
using Inkscape::IO::Resource::USER;
@@ -279,7 +278,7 @@ bool sp_file_open(const Glib::ustring &uri,
}
if ( INKSCAPE.use_gui() ) {
-
+
SPNamedView *nv = desktop->namedview;
if (nv->lockguides) {
nv->lockGuides();
@@ -962,7 +961,6 @@ sp_file_save_template(Gtk::Window &parentWindow, Glib::ustring name,
Glib::ustring author, Glib::ustring description, Glib::ustring keywords,
bool isDefault)
{
-
if (!SP_ACTIVE_DOCUMENT || name.length() == 0)
return;
@@ -1029,10 +1027,11 @@ sp_file_save_template(Gtk::Window &parentWindow, Glib::ustring name,
Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
}
- name.append(".svg");
+ auto encodedName = Glib::uri_escape_string(name);
+ encodedName.append(".svg");
auto filename = Inkscape::IO::Resource::get_path_ustring(USER, TEMPLATES,
- name.c_str());
+ encodedName.c_str());
file_save(parentWindow, document, filename,
Inkscape::Extension::db.get(".svg"), false, false,
Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);