Просмотр исходного кода

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 лет назад
Родитель
Сommit
a0256023a1
1 измененных файлов с 1 добавлено и 0 удалено
  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 = preg_replace('%^(/api)?(/greader\.php)?%', '', $pathInfo);	//Discard common errors
 if ($pathInfo == '') {
 	exit('OK');
 }