diff --git a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp index 316389d65c..fafd097930 100644 --- a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp +++ b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp @@ -1,5 +1,6 @@ #include "MultiNozzleSync.hpp" +#include "../GUI.hpp" #include "../GUI_App.hpp" #include "../I18N.hpp" #include "../Plater.hpp" @@ -21,8 +22,6 @@ #include #include -#include -#include #include #include @@ -641,8 +640,7 @@ NozzleListTable::NozzleListTable(wxWindow* parent) : wxPanel(parent,wxID_ANY,wxD m_web_view->AddScriptMessageHandler("nozzleListTable"); m_web_view->EnableContextMenu(false); fs::path filepath = fs::path(resources_dir()) / "web/flush/NozzleListTable.html"; - wxFileName fn(wxString::FromUTF8(filepath.string())); - wxString url = wxFileSystem::FileNameToURL(fn); + wxString url = file_url_from_path(filepath); m_web_view->LoadURL(url); auto sizer = new wxBoxSizer(wxVERTICAL); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 9a473c7c8a..126f090a0b 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -464,7 +464,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const int max_flush_volume) : wxString filepath_str = from_path(filepath); wxFileName fn(filepath_str); if(fn.FileExists()) { - wxString url = wxFileSystem::FileNameToURL(fn); + wxString url = file_url_from_path(filepath); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__<< "File exists and load url " << url.ToStdString(); m_webview->LoadURL(url); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__<< "Successfully loaded url: " << url.ToStdString(); diff --git a/tests/slic3rutils/test_plugin_host_api.cpp b/tests/slic3rutils/test_plugin_host_api.cpp index 6e1b8fd92a..0283bb5744 100644 --- a/tests/slic3rutils/test_plugin_host_api.cpp +++ b/tests/slic3rutils/test_plugin_host_api.cpp @@ -228,6 +228,17 @@ TEST_CASE("A reloaded plugin page is recognised by its base URL, fragment aside" CHECK_FALSE(is_content_url("")); } +TEST_CASE("A reloaded plugin page is recognised when the resources path holds a '#'", "[PluginHost]") +{ + using namespace Slic3r::GUI::web_hosting; + + const Slic3r::ScopedResourcesDir resources("web#content check"); + + CHECK(is_content_url(content_base_url())); + CHECK(is_content_url(content_base_url() + "#tab2")); + CHECK_FALSE(is_content_url(content_base_url() + "guide.html")); +} + TEST_CASE("Plugin host API exposes model geometry and structure to Python", "[PluginHost][Python]") { using Catch::Matchers::WithinAbs;