]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/tag.php
Fix canonical tags in notice and in URLs
[quix0rs-gnu-social.git] / actions / tag.php
index 039cd9660b71a0a0ad1fb0cbe7b9d927feeea889..803026e624d574df2d2ebb9ebf3cbc8f921dd639 100644 (file)
@@ -24,13 +24,18 @@ class TagAction extends Action
     function prepare($args)
     {
         parent::prepare($args);
-        $this->tag = $this->trimmed('tag');
+        $taginput = $this->trimmed('tag');
+        $this->tag = common_canonical_tag($taginput);
 
         if (!$this->tag) {
             common_redirect(common_local_url('publictagcloud'), 301);
             return false;
         }
 
+        if ($this->tag != $taginput) {
+            common_redirect(common_local_url('tag', array('tag' => $this->tag)));
+        }
+
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
         return true;
     }