From 5c72e0c354cd4e348da5c6c39475c7185e13c6be Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 8 Oct 2015 01:23:31 +0200 Subject: [PATCH] Fix for "Fix handling of relative URLs starting with "/" in wxHTML" Commit 7e8c2cc4a5e80cc4ff8e55a3eb4ade4d6e5b0a11 fixed handling of http:// URLs but completely broke the handling of file:// ones under MSW where the file paths contain colons and so are different in escaped and unescaped forms and so passing the unescaped "myfullurl" to wxFileSystem::OpenFile() simply didn't work at all. Fix this while still continuing to use "myfullurl" by keeping "myfullurl" itself escaped and only unescaping it right before passing it to OnHTMLOpeningURL() so that this public virtual method is still called with the same value as before, but "myfullurl", and hence "myurl" passed to OpenFile() later, is kept escaped. Closes #17148. --- src/html/winpars.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index 4108eb1873..c862b9cd60 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -293,7 +293,7 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type, // consider url as absolute path first wxURI current(myurl); - myfullurl = current.BuildUnescapedURI(); + myfullurl = current.BuildURI(); // if not absolute then ... if( current.IsReference() ) @@ -306,7 +306,7 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type, { wxURI path(myfullurl); path.Resolve( base ); - myfullurl = path.BuildUnescapedURI(); + myfullurl = path.BuildURI(); } else { @@ -315,13 +315,18 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type, { basepath += myurl; wxURI connected( basepath ); - myfullurl = connected.BuildUnescapedURI(); + myfullurl = connected.BuildURI(); } } } wxString redirect; - status = m_windowInterface->OnHTMLOpeningURL(type, myfullurl, &redirect); + status = m_windowInterface->OnHTMLOpeningURL + ( + type, + wxURI::Unescape(myfullurl), + &redirect + ); if ( status != wxHTML_REDIRECT ) { myurl = myfullurl;