[GithubIssueBridge] Don't return error messages in detectParameters()

detectParameters() is called in a loop for all bridges on a URL, thus
if a bridge returns an error message, the output messages get mixed
up and all detect operations fail.

This seems to be a limitation of the detect function for now.
This commit is contained in:
logmanoriginal 2019-06-13 19:49:48 +02:00
parent 2559dbbf49
commit 6d6d6037a3

View file

@ -242,24 +242,8 @@ class GithubIssueBridge extends BridgeAbstract {
public function detectParameters($url) {
$help = <<<EOD
Usage:
For project issues the URL must include /<user>/<project>
For issue comments the URL must include /<user>/<project>/issues/<issue-number>
Examples:
- https://github.com/rss-bridge/rss-bridge
- https://github.com/rss-bridge/rss-bridge/issues/1
Issue comments for project issues are enabled if the URL points to issues
https://github.com/rss-bridge/rss-bridge/issues
EOD;
if(filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) === false
|| strpos($url, self::URI) !== 0) {
returnClientError('Invalid URL' . $help);
return null;
}
@ -273,11 +257,7 @@ EOD;
} break;
case 3: { // Project issues with issue comments
if($path_segments[2] !== 'issues') {
returnClientError('Invalid path. Expected "/issues/", found "/'
. $path_segments[2]
. '/"'
. $help
);
return null;
}
list($user, $project) = $path_segments;
$show_comments = 'on';
@ -286,7 +266,7 @@ EOD;
list($user, $project, /* issues */, $issue) = $path_segments;
} break;
default: {
returnClientError('Invalid path.' . $help);
return null;
}
}