PATCH for bug #76725

"Mario Sopena" <[email protected]>
Newsgroups gmane.comp.gnome.mono.documentation
Message-ID <[email protected]>
Hello,

long time without coding so I've started with a simple patch. This solves
the bug #76725 about the malformed Uri in monodoc. See:
http://bugzilla.ximian.com/show_bug.cgi?id=76725

The patch is really simple as the solution was given by Sebastien in the
same bug report. The steps followed where: compile a version of the classes
without the hack for monodoc, check that monodoc crashes with the
MalformedUriException, change the generation of the Uri and check that
monodoc works again.

Now the hack can be reverted without breaking monodoc.

Saludos,

Mario Sopena

_______________________________________________
Mono-docs-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-docs-list
uripatch.txt (text/plain, 6.5 KB)
Index: engine/editing.cs
===================================================================
--- engine/editing.cs	(revision 59521)
+++ engine/editing.cs	(working copy)
@@ -65,8 +65,8 @@
 			
 			XmlDocument d;
 			
-			if (uSplit[0].StartsWith("monodoc://")) {
-				int prov = int.Parse (uSplit [0].Substring("monodoc://".Length));
+			if (uSplit[0].StartsWith("monodoc:///")) {
+				int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length));
 				d = tree.GetHelpSourceFromId (prov).GetHelpXmlWithChanges (id);
 			} else if (uSplit[0].StartsWith("file:")) {
 				d = new XmlDocument();
@@ -87,8 +87,8 @@
 			string xp = uSplit [2];
 			string id =  uSplit [1];
 						
-			if (uSplit[0].StartsWith("monodoc://")) {
-				int prov = int.Parse (uSplit [0].Substring("monodoc://".Length));
+			if (uSplit[0].StartsWith("monodoc:///")) {
+				int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length));
 				HelpSource hs = tree.GetHelpSourceFromId (prov);
 				
 				changes.AddChange (hs.Name, hs.GetRealPath (id), xp, node, node_url);
@@ -116,8 +116,8 @@
 			string xp = uSplit [2];
 			string id = uSplit [1];
 						
-			if (uSplit[0].StartsWith("monodoc://")) {
-				int prov = int.Parse (uSplit [0].Substring("monodoc://".Length));
+			if (uSplit[0].StartsWith("monodoc:///")) {
+				int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length));
 				HelpSource hs = tree.GetHelpSourceFromId (prov);
 				
 				changes.RemoveChange (hs.Name, hs.GetRealPath (id), xp);
@@ -134,8 +134,8 @@
 			string xp = uSplit [2];
 			string id =  uSplit [1];
 						
-			if (uSplit[0].StartsWith("monodoc://")) {
-				int prov = int.Parse (uSplit [0].Substring("monodoc://".Length));
+			if (uSplit[0].StartsWith("monodoc:///")) {
+				int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length));
 				HelpSource hs = tree.GetHelpSourceFromId (prov);
 				hs.RenderPreviewDocs (new_node, w);
 			} else {
Index: engine/provider.cs
===================================================================
--- engine/provider.cs	(revision 59521)
+++ engine/provider.cs	(working copy)
@@ -470,7 +470,7 @@
 		ZipEntry entry = zip_file.GetEntry (id);
 		if (entry != null) {
 			Stream s = zip_file.GetInputStream (entry);
-			string url = "monodoc://" + SourceID + "@" + System.Web.HttpUtility.UrlEncode (id) + "@";
+			string url = "monodoc:///" + SourceID + "@" + System.Web.HttpUtility.UrlEncode (id) + "@";
 			return new XmlTextReader (url, s);
 		}
 		return null;
@@ -484,7 +484,7 @@
 		ZipEntry entry = zip_file.GetEntry (id);
 		if (entry != null) {
 			Stream s = zip_file.GetInputStream (entry);
-			string url = "monodoc://" + SourceID + "@" + System.Web.HttpUtility.UrlEncode (id) + "@";
+			string url = "monodoc:///" + SourceID + "@" + System.Web.HttpUtility.UrlEncode (id) + "@";
 			XmlReader r = new XmlTextReader (url, s);
 			XmlDocument ret = new XmlDocument ();
 			ret.Load (r);
Index: engine/mono-ecma-css.xsl
===================================================================
--- engine/mono-ecma-css.xsl	(revision 59521)
+++ engine/mono-ecma-css.xsl	(working copy)
@@ -14,7 +14,7 @@
 <xsl:stylesheet
 	version="1.0"
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-	xmlns:monodoc="monodoc://extensions"
+	xmlns:monodoc="monodoc:///extensions"
 	exclude-result-prefixes="monodoc"
 	>
 	
Index: engine/ecmaspec-provider.cs
===================================================================
--- engine/ecmaspec-provider.cs	(revision 59521)
+++ engine/ecmaspec-provider.cs	(working copy)
@@ -158,7 +158,7 @@
 
 			XmlReader xml_reader = new XmlTextReader (stream);
 			ecma_transform.Load (xml_reader);
-			args.AddExtensionObject ("monodoc://extensions", new ExtObj()); 
+			args.AddExtensionObject ("monodoc:///extensions", new ExtObj()); 
 		}
 		
 		if (ecma_xml == null) return "";
Index: engine/mono-ecma.xsl
===================================================================
--- engine/mono-ecma.xsl	(revision 59521)
+++ engine/mono-ecma.xsl	(working copy)
@@ -12,7 +12,7 @@
 <xsl:stylesheet
 	version="1.0"
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-	xmlns:monodoc="monodoc://extensions"
+	xmlns:monodoc="monodoc:///extensions"
 	exclude-result-prefixes="monodoc"
 	>
 	
Index: engine/ecma-provider.cs
===================================================================
--- engine/ecma-provider.cs	(revision 59521)
+++ engine/ecma-provider.cs	(working copy)
@@ -506,7 +506,7 @@
 				return null;
 
 			XsltArgumentList args = new XsltArgumentList();
-			args.AddExtensionObject("monodoc://extensions", ExtObject);
+			args.AddExtensionObject("monodoc:///extensions", ExtObject);
 			args.AddParam("show", "", "masteroverview");
 			string s = Htmlize(new XPathDocument (summary), args);
 			return BuildHtml (css_ecma_code, s); 
@@ -827,7 +827,7 @@
 				return null;
 
 			XsltArgumentList args = new XsltArgumentList();
-			args.AddExtensionObject("monodoc://extensions", ExtObject);
+			args.AddExtensionObject("monodoc:///extensions", ExtObject);
 			args.AddParam("show", "", "namespace");
 			args.AddParam("namespace", "", ns_name);
 			string s = Htmlize(new XPathDocument (summary), args);
@@ -924,7 +924,7 @@
 
 		XsltArgumentList args = new XsltArgumentList();
 
-		args.AddExtensionObject("monodoc://extensions", ExtObject);
+		args.AddExtensionObject("monodoc:///extensions", ExtObject);
 		
 		if (rest == "") {
 			args.AddParam("show", "", "typeoverview");
@@ -993,7 +993,7 @@
 	public override void RenderPreviewDocs (XmlNode newNode, XmlWriter writer)
 	{
 		XsltArgumentList args = new XsltArgumentList ();
-		args.AddExtensionObject ("monodoc://extensions", ExtObject);
+		args.AddExtensionObject ("monodoc:///extensions", ExtObject);
 		
 		Htmlize (newNode, args, writer);
 	}
@@ -1865,7 +1865,7 @@
 
 			//transform the recently created masteroverview.xml
 			XsltArgumentList args = new XsltArgumentList();
-			args.AddExtensionObject("monodoc://extensions", ExtObject);
+			args.AddExtensionObject("monodoc:///extensions", ExtObject);
 			args.AddParam("show", "", "masteroverview");
 			string s = EcmaHelpSource.Htmlize(new XPathDocument (reader), args);
 			return BuildHtml (css_ecma_code, s); 
Index: engine/ecmaspec-html-css.xsl
===================================================================
--- engine/ecmaspec-html-css.xsl	(revision 59521)
+++ engine/ecmaspec-html-css.xsl	(working copy)
@@ -2,7 +2,7 @@
 <xsl:stylesheet 
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	version="1.0"
-	xmlns:monodoc="monodoc://extensions"
+	xmlns:monodoc="monodoc:///extensions"
 	exclude-result-prefixes="monodoc"
 	>
 <xsl:output omit-xml-declaration="yes" />
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.