| Index: src/plugin/PluginTabBase.cpp |
| =================================================================== |
| --- a/src/plugin/PluginTabBase.cpp |
| +++ b/src/plugin/PluginTabBase.cpp |
| @@ -157,9 +157,12 @@ |
| // Declared static because the value is derived from an installation directory, which won't change during run-time. |
| static auto dir = FileUrl(HtmlFolderPath()); |
| + dir = EscapeUrl(CanonicalizeUrl(dir)); |
|
Eric
2016/09/07 16:50:52
There's no need to treat 'dir' as arising from a U
Oleksandr
2016/09/08 02:51:15
The thinking here is that Since dir arrives from a
|
| + std::wstring urlCanonicalized = EscapeUrl(CanonicalizeUrl(url)); |
|
Eric
2016/09/07 16:50:52
As a point of English usage, `urlCanonical` (with
Oleksandr
2016/09/08 02:51:15
Done.
|
| + |
| DEBUG_GENERAL([&]() -> std::wstring { |
| std::wstring log = L"InjectABP. Current URL: "; |
| - log += url; |
| + log += urlCanonicalized; |
|
Eric
2016/09/07 16:50:52
It would be better here to use the argument `url`
Oleksandr
2016/09/08 02:51:15
During debugging I actually find it more convenien
|
| log += L", template directory URL: "; |
| log += dir; |
| return log; |
| @@ -168,14 +171,15 @@ |
| /* |
| * The length check here is defensive, in case the document URL is truncated for some reason. |
| */ |
| - if (url.length() < 5) |
| + if (urlCanonicalized.length() < 5) |
| { |
| // We can't match ".html" at the end of the URL if it's too short. |
| return false; |
| } |
| - auto urlCstr = url.c_str(); |
| + auto urlCstr = urlCanonicalized.c_str(); |
| // Check the prefix to match our directory |
| // Check the suffix to be an HTML file |
| + // Compare escaped version and return |
| return (_wcsnicmp(urlCstr, dir.c_str(), dir.length()) == 0) && |
| (_wcsnicmp(urlCstr + url.length() - 5, L".html", 5) == 0); |
| } |