Skip to content

Commit

Permalink
StartView: Escape file paths when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Jookia authored and chennes committed Jul 2, 2024
1 parent 0f46250 commit 04cc890
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Mod/Start/Gui/StartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <App/DocumentObject.h>
#include <App/Application.h>
#include <Base/Interpreter.h>
#include <Base/Tools.h>
#include <Gui/Application.h>
#include <Gui/Command.h>
#include <gsl/pointers>
Expand Down Expand Up @@ -388,7 +389,9 @@ void StartView::postStart(PostStartBehavior behavior) const
void StartView::fileCardSelected(const QModelIndex& index)
{
auto file = index.data(static_cast<int>(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);
Expand Down

0 comments on commit 04cc890

Please sign in to comment.