Fixed #395: filenames are URL-encoded when used in combination with {UP} tags.
This commit is contained in:
parent
d460d9bd47
commit
9e9ceb2ec7
2 changed files with 23 additions and 2 deletions
|
@ -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.410")]
|
[assembly: AssemblyVersion("3.0.1.411")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.410")]
|
[assembly: AssemblyFileVersion("3.0.1.411")]
|
||||||
|
|
|
@ -232,6 +232,7 @@ 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);
|
||||||
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;
|
||||||
|
@ -869,6 +870,26 @@ namespace ScrewTurn.Wiki {
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Encodes a filename used in combination with {UP} tags.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="buffer">The buffer.</param>
|
||||||
|
/// <param name="startIndex">The index where to start working.</param>
|
||||||
|
private static void EncodeFilename(StringBuilder buffer, int startIndex) {
|
||||||
|
// 1. Find end of the filename (first pipe or closed square bracket)
|
||||||
|
// 2. Encode the string
|
||||||
|
|
||||||
|
string allData = buffer.ToString();
|
||||||
|
|
||||||
|
int endIndex = allData.IndexOfAny(new[] { '|', ']' }, startIndex);
|
||||||
|
if(endIndex > startIndex) {
|
||||||
|
int len = endIndex - startIndex;
|
||||||
|
string value = Tools.UrlEncode(allData.Substring(startIndex, len));
|
||||||
|
buffer.Remove(startIndex, len);
|
||||||
|
buffer.Insert(startIndex, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Builds the anchor markup for a header.
|
/// Builds the anchor markup for a header.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue