Procházet zdrojové kódy

Fix Pico::getPageUrl()

With enabled URL rewriting we must call rawurlencode() on the file path parts rather the whole path
Daniel Rudolf před 9 roky
rodič
revize
f9e9642c22
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      lib/Pico.php

+ 7 - 1
lib/Pico.php

@@ -1187,7 +1187,13 @@ class Pico
      */
     public function getPageUrl($page)
     {
-        return $this->getBaseUrl() . ((!$this->isUrlRewritingEnabled() && !empty($page)) ? '?' : '') . rawurlencode($page);
+        if (empty($page)) {
+            return $this->getBaseUrl();
+        } elseif (!$this->isUrlRewritingEnabled()) {
+            return $this->getBaseUrl() . '?' . rawurlencode($page);
+        } else {
+            return $this->getBaseUrl() . implode('/', array_map('rawurlencode', explode('/', $page)));
+        }
     }
 
     /**