From: Joey Hess <joey@gnu.kitenet.net>
Date: Sat, 6 Jun 2009 06:36:40 +0000 (-0400)
Subject: goto: Support being passed a page title that is not a valid page name, to support... 
X-Git-Tag: 3.141~28
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/e40d2a6b2b1bdf677f11cc4a71595acf609d1e75?hp=--cc

goto: Support being passed a page title that is not a valid page name, to support several cases including mercurial's long user names on the RecentChanges page, and urls with spaces being handled by the 404 plugin.
---

e40d2a6b2b1bdf677f11cc4a71595acf609d1e75
diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm
index 3f40c5859..2e2dc04a1 100644
--- a/IkiWiki/Plugin/goto.pm
+++ b/IkiWiki/Plugin/goto.pm
@@ -32,6 +32,12 @@ sub cgi_goto ($;$) {
 		}
 	}
 
+	# It's possible that $page is not a valid page name;
+	# if so attempt to turn it into one.
+	if ($page !~ /$config{wiki_file_regexp}/) {
+		$page=titlepage($page);
+	}
+
 	IkiWiki::loadindex();
 
 	# If the page is internal (like a comment), see if it has a
diff --git a/debian/changelog b/debian/changelog
index df4429326..7f8257813 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ ikiwiki (3.15) UNRELEASED; urgency=low
     fails for any reason, disable it in the generated file.
     Closes: 532001
   * pagecount: Fix broken optimisation for * pagespec.
+  * goto: Support being passed a page title that is not a valid page
+    name, to support several cases including mercurial's long user
+    names on the RecentChanges page, and urls with spaces being handled
+    by the 404 plugin.
 
  -- Joey Hess <joeyh@debian.org>  Tue, 02 Jun 2009 17:03:41 -0400
 
diff --git a/doc/bugs/goto_with_bad_page_name.mdwn b/doc/bugs/goto_with_bad_page_name.mdwn
index 722c4e266..bc462c840 100644
--- a/doc/bugs/goto_with_bad_page_name.mdwn
+++ b/doc/bugs/goto_with_bad_page_name.mdwn
@@ -20,4 +20,6 @@ pass it through titlepage if not.
 with spaces" to "http://wiki/some_page_with_spaces", if the latter exists.
 That seems like a fairly good thing.)
 
+[[done]]
+
 --[[Joey]]