Fix for "Fix handling of relative URLs starting with "/" in wxHTML"

Commit 7e8c2cc4a5 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.
This commit is contained in:
Vadim Zeitlin
2015-10-08 01:23:31 +02:00
parent a2e359613e
commit 5c72e0c354

View File

@@ -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;