X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68ce1d34990c79ada9eca14bf8d85dd86dd0a9e3..980ebb95527c974fa71e8e97c38543e8d731c7c7:/src/common/filesys.cpp diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 038e55407f..fc12af7d55 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -193,8 +193,10 @@ wxString wxFileSystemHandler::GetAnchor(const wxString& location) for (int i = l-1; i >= 0; i--) { c = location[i]; - if (c == wxT('#')) return location.Right(l-i-1); - else if ((c == wxT('.')) || (c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':'))) return wxEmptyString; + if (c == wxT('#')) + return location.Right(l-i-1); + else if ((c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':'))) + return wxEmptyString; } return wxEmptyString; } @@ -663,6 +665,16 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename) url.Replace(g_nativePathString, g_unixPathString); url.Replace(wxT("%"), wxT("%25")); // '%'s must be replaced first! url.Replace(wxT("#"), wxT("%23")); + + // notice that all colons *must* be encoded in the paths used by + // wxFileSystem even though this makes URLs produced by this method + // unusable with IE under Windows as it requires "file:///c:/foo.bar" and + // doesn't accept "file:///c%3a/foo.bar" -- but then we never made any + // guarantees about general suitability of the strings returned by this + // method, they must work with wxFileSystem only and not encoding the colon + // breaks handling of "http://wherever/whatever.zip#zip:filename.ext" URLs + // so we really can't do this without heavy changes to the parsing code + // here, in particular in GetRightLocation() url.Replace(wxT(":"), wxT("%3A")); url = wxT("file:") + url; return url;