From cfff80a730803b3e419b8363db41ec69fce42594 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 9 Apr 2011 17:30:59 -0400 Subject: [PATCH] If you search for a tag, redirect to tag page --- actions/noticesearch.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/actions/noticesearch.php b/actions/noticesearch.php index 1f43af800d..357e8ba192 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -48,10 +48,21 @@ require_once INSTALLDIR.'/lib/searchaction.php'; */ class NoticesearchAction extends SearchAction { + protected $q = null; + function prepare($args) { parent::prepare($args); + $this->q = $this->trimmed('q'); + + // FIXME: very dependent on tag format + if (preg_match('/^#([\pL\pN_\-\.]{1,64})/ue', $this->q)) { + common_redirect(common_local_url('tag', + array('tag' => common_canonical_tag(substr($this->q, 1)))), + 303); + } + common_set_returnto($this->selfUrl()); return true; -- 2.39.5