From cf3f8019c3203a0bc3050fc90b41b6cfc9e8db10 Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Mon, 28 Sep 2026 20:02:53 +0800 Subject: [PATCH] Encode the Login Error Page URL and Cover More Windows Path Forms The login dialog's error page was still loaded from a raw resources path; it now uses file_url_from_path like the other local pages. The Windows file URL tests now also cover a resources path joined with a forward-slash relative path, as the callers build them, and a UNC path. --- src/slic3r/GUI/WebUserLoginDialog.cpp | 2 +- tests/slic3rutils/test_file_url.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index 829e7ef106..72860e3bdc 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -599,7 +599,7 @@ void ZUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) bool ZUserLogin::ShowErrorPage() { - wxString ErrortUrl = from_u8((boost::filesystem::path(resources_dir()) / "web\\login\\error.html").make_preferred().string()); + wxString ErrortUrl = file_url_from_path(boost::filesystem::path(resources_dir()) / "web/login/error.html"); load_url(ErrortUrl); return true; diff --git a/tests/slic3rutils/test_file_url.cpp b/tests/slic3rutils/test_file_url.cpp index 60881cd92b..484067b57e 100644 --- a/tests/slic3rutils/test_file_url.cpp +++ b/tests/slic3rutils/test_file_url.cpp @@ -54,6 +54,11 @@ TEST_CASE("A file URL of a Windows path has a drive letter and forward slashes", "file:///D:/%23OneDrive/OrcaSlicer/resources/web/guide/0/index.html" }, { L"D:\\100%\\OrcaSlicer\\resources\\web\\homepage\\index.html", "file:///D:/100%25/OrcaSlicer/resources/web/homepage/index.html" }, + // Callers join the resources directory with a forward-slash relative path. + { L"D:\\#OneDrive\\OrcaSlicer\\resources/web/homepage/index.html", + "file:///D:/%23OneDrive/OrcaSlicer/resources/web/homepage/index.html" }, + { L"\\\\server\\share\\OrcaSlicer\\resources\\web\\homepage\\index.html", + "file://server/share/OrcaSlicer/resources/web/homepage/index.html" }, })); CHECK(file_url_from_path(boost::filesystem::path(path)).utf8_string() == url); }