r106520 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106519‎ | r106520 | r106521 >
Date:19:08, 17 December 2011
Author:petrb
Status:deferred
Tags:
Comment:
some fixes regarding invalid characters which make troubles in windows
Modified paths:
  • /trunk/tools/wmib/Core.cs (modified) (history)

Diff [purge]

Index: trunk/tools/wmib/Core.cs
@@ -115,6 +115,10 @@
116116 name = name.Replace("|", "\\|");
117117 name = name.Replace("]", "\\]");
118118 name = name.Replace("[", "\\[");
 119+ name = name.Replace("\\", "\\\\");
 120+ name = name.Replace("^", "\\^");
 121+ name = name.Replace("{", "\\{");
 122+ name = name.Replace("}", "\\}");
119123 return name;
120124 }
121125
@@ -950,6 +954,11 @@
951955 return false;
952956 }
953957
 958+ public static bool validFile(string name)
 959+ {
 960+ return !(name.Contains(" ") || name.Contains("?") || name.Contains("|") || name.Contains("/") || name.Contains("\\") || name.Contains(">") || name.Contains("<") || name.Contains("*"));
 961+ }
 962+
954963 /// <summary>
955964 ///
956965 /// </summary>
@@ -968,7 +977,7 @@
969978 if (message.Contains(" "))
970979 {
971980 string channel = message.Substring(message.IndexOf(" ") + 1);
972 - if (channel.Contains(" ") || channel.Contains("|") || channel.Contains("/") || (channel.Contains("#") == false))
 981+ if ( !validFile(channel) || (channel.Contains("#") == false))
973982 {
974983 Message("Invalid name", chan.name);
975984 return;

Status & tagging log