فهرست منبع

Minz: fix absolute URL bug (#2006)

* Fix absolute URL bug

https://github.com/FreshRSS/FreshRSS/issues/1946

* Better base_url guess in install.php

* Revert changes in install.php
Alexandre Alapetite 7 سال پیش
والد
کامیت
4e8932d4bb
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 1 1
      app/Controllers/indexController.php
  2. 5 1
      lib/Minz/Url.php

+ 1 - 1
app/Controllers/indexController.php

@@ -139,7 +139,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
 		}
 
 		// No layout for RSS output.
-		$this->view->url = empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING'];
+		$this->view->url = PUBLIC_TO_INDEX_PATH . '/' . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']);
 		$this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
 		$this->view->_useLayout(false);
 		header('Content-Type: application/rss+xml; charset=utf-8');

+ 5 - 1
lib/Minz/Url.php

@@ -27,6 +27,10 @@ class Minz_Url {
 			$url_string = Minz_Request::getBaseUrl();
 			if ($url_string == '') {
 				$url_string = Minz_Request::guessBaseUrl();
+				if (PUBLIC_RELATIVE === '..') {
+					//TODO: Implement proper resolver of relative parts such as /test/./../
+					$url_string = dirname($url_string);
+				}
 			}
 			if ($isArray) {
 				$url_string .= PUBLIC_TO_INDEX_PATH;
@@ -39,7 +43,7 @@ class Minz_Url {
 		}
 
 		if ($isArray) {
-			$url_string .= self::printUri($url, $encodage);
+			$url_string .= '/' . self::printUri($url, $encodage);
 		} elseif ($encodage === 'html') {
 			$url_string = Minz_Helper::htmlspecialchars_utf8($url_string . $url);
 		} else {