Forráskód Böngészése

API discard common Path Info errors (#3061)

Some apps auto-complete `/api/greader.php` while some do not.
Discard common errors instead of failing, to be more user-friendly.
E.g. if the user types the full API URL in Readrops https://github.com/FreshRSS/FreshRSS/issues/3059#issuecomment-644149548
Alexandre Alapetite 5 éve
szülő
commit
a0256023a1
1 módosított fájl, 1 hozzáadás és 0 törlés
  1. 1 0
      p/api/greader.php

+ 1 - 0
p/api/greader.php

@@ -912,6 +912,7 @@ function markAllAsRead($streamId, $olderThanId) {
 }
 }
 
 
 $pathInfo = empty($_SERVER['PATH_INFO']) ? '' : urldecode($_SERVER['PATH_INFO']);
 $pathInfo = empty($_SERVER['PATH_INFO']) ? '' : urldecode($_SERVER['PATH_INFO']);
+$pathInfo = preg_replace('%^(/api)?(/greader\.php)?%', '', $pathInfo);	//Discard common errors
 if ($pathInfo == '') {
 if ($pathInfo == '') {
 	exit('OK');
 	exit('OK');
 }
 }