- summary: RemoveServerNameFromUrls Doesn't Work in All Cases --> RemoveServerNameFromUrls Doesn't Work for SSL
Before I get to the bug that I've found, I wanted to
thank you for creating this control. We've found it to
be increadibly usefull in a number of situations.
As far as the error goes, The problem is with regards to
SSL (specifically "https") support and the removal of
Server Names from Urls. The
RemoveServerNamesFromUrls function only strips out
urls for non ssl hosts ("http") and does nothing for SSL
hosts ("https").
Version: FTBv1-6-3
File: Common\postprocessor.cs
Function: RemoveServerNamesFromUrls
Original Source:
public string
RemoveServerNamesFromUrls(string input, string
servername) {
input = Regex.Replace
(input,"HREF=http://" +
servername,"HREF=",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"HREF=\"http://" +
servername,"HREF=\"",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"src=http://" +
servername,"src=",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"src=\"http://" +
servername,"src=\"",RegexOptions.IgnoreCase);
return input;
}
Solution:
Need to add statements to account for "https" within
the innerHTML of the editor window.
Updated Source (unless of course you only want to strip
https if the user has FreeTextBox.EnableSsl=true):
public string
RemoveServerNamesFromUrls(string input, string
servername) {
input = Regex.Replace
(input,"HREF=http://" +
servername,"HREF=",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"HREF=\"http://" +
servername,"HREF=\"",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"src=http://" +
servername,"src=",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"src=\"http://" +
servername,"src=\"",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"HREF=https://" +
servername,"HREF=",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"HREF=\"https://" +
servername,"HREF=\"",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"src=https://" +
servername,"src=",RegexOptions.IgnoreCase);
input = Regex.Replace
(input,"src=\"https://" +
servername,"src=\"",RegexOptions.IgnoreCase);
return input;
}