From 5a66b77307f3e9c82e64239bde00160f9fe0d08f Mon Sep 17 00:00:00 2001 From: Jookia Date: Tue, 2 Jul 2024 19:17:35 +1000 Subject: [PATCH] StartView: Escape file paths when loading --- src/Mod/Start/Gui/StartView.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/Start/Gui/StartView.cpp b/src/Mod/Start/Gui/StartView.cpp index bac26ed6c3..432c469bea 100644 --- a/src/Mod/Start/Gui/StartView.cpp +++ b/src/Mod/Start/Gui/StartView.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -388,7 +389,9 @@ void StartView::postStart(PostStartBehavior behavior) const void StartView::fileCardSelected(const QModelIndex& index) { auto file = index.data(static_cast(Start::DisplayedFilesModelRoles::path)).toString(); - auto command = std::string("FreeCAD.loadFile('") + file.toStdString() + "')"; + std::string escapedstr = Base::Tools::escapedUnicodeFromUtf8(file.toStdString().c_str()); + escapedstr = Base::Tools::escapeEncodeFilename(escapedstr); + auto command = std::string("FreeCAD.loadFile('") + escapedstr + "')"; try { Base::Interpreter().runString(command.c_str()); postStart(PostStartBehavior::doNotSwitchWorkbench);