Fixed #400: filenames used in combination with {UP} are now escaped only when used inside WikiMarkup links.

This commit is contained in:
Dario Solera 2009-10-23 09:01:16 +00:00
parent f30df0e8a3
commit 2199499e21
2 changed files with 10 additions and 3 deletions

View file

@ -16,5 +16,5 @@ using System.Reflection;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.1.419")] [assembly: AssemblyVersion("3.0.1.420")]
[assembly: AssemblyFileVersion("3.0.1.419")] [assembly: AssemblyFileVersion("3.0.1.420")]

View file

@ -232,7 +232,14 @@ namespace ScrewTurn.Wiki {
match = ExtendedUpRegex.Match(sb.ToString()); match = ExtendedUpRegex.Match(sb.ToString());
while(match.Success) { while(match.Success) {
if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) {
EncodeFilename(sb, match.Index + match.Length); // Encode filename only if it's used inside a link,
// i.e. check if {UP} is used just after a '['
// This works because links are processed afterwards
string sbString = sb.ToString();
if(match.Index > 0 && sbString[match.Index - 1] == '[') {
EncodeFilename(sb, match.Index + match.Length);
}
sb.Remove(match.Index, match.Length); sb.Remove(match.Index, match.Length);
string prov = match.Groups[1].Value.StartsWith(":") ? match.Value.Substring(4, match.Value.Length - 5) : match.Value.Substring(3, match.Value.Length - 4); string prov = match.Groups[1].Value.StartsWith(":") ? match.Value.Substring(4, match.Value.Length - 5) : match.Value.Substring(3, match.Value.Length - 4);
string page = null; string page = null;