mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 23:01:17 +00:00
Percent-Encode Local File URLs for Embedded Web Pages (#15961)
* Percent-Encode Local File URLs for Embedded Web Pages The Home tab, setup wizard, Project tab and other embedded pages were loaded from file:// URLs built by pasting the resources path into a string. A '#', '%' or '?' in the install path was then read as a URL fragment, escape or query, so the pages failed to load, for example a portable install under D:\#OneDrive showed a directory listing instead of the setup wizard. Add file_url_from_path(), built on wxFileSystem::FileNameToURL, and use it wherever a local page or image URL is built from a path. Queries such as ?lang= are appended after the path is encoded. The wizard's printer cover images are passed to the page as file URLs too. * 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. * Build the Flush Dialog Page URLs with the Shared Helper WipingDialog and NozzleListTable still called wxFileSystem::FileNameToURL directly. They now go through file_url_from_path like every other local page, so the URLs are built in one place. Adds a test for a resources directory with a '#' in its name, which the plugin page check did not recognise before.
This commit is contained in:
@@ -45,10 +45,10 @@ const std::vector<std::string> license_list = {
|
||||
ProjectPanel::ProjectPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : wxPanel(parent, id, pos, size, style)
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
m_project_home_url = wxString::Format("file://%s/web/model/index.html", from_u8(resources_dir()));
|
||||
m_project_home_url = file_url_from_path(boost::filesystem::path(resources_dir()) / "web/model/index.html");
|
||||
wxString strlang = wxGetApp().current_language_code_safe();
|
||||
if (strlang != "")
|
||||
m_project_home_url = wxString::Format("file://%s/web/model/index.html?lang=%s", from_u8(resources_dir()), strlang);
|
||||
m_project_home_url += "?lang=" + strlang;
|
||||
|
||||
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user