[FacebookBridge] Return error if username starts with slash
Requesting a username with a leading slash would cause error 500 because the requested URI would contain two slashes in a row. For example username "/test" would result in: https://facebook.com//test References #628
This commit is contained in:
parent
41b7984a4e
commit
df6da837dc
1 changed files with 7 additions and 0 deletions
|
@ -127,7 +127,14 @@ class FacebookBridge extends BridgeAbstract {
|
|||
'header' => 'Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE') . "\r\n"
|
||||
)
|
||||
);
|
||||
|
||||
$context = stream_context_create($http_options);
|
||||
|
||||
// First character cannot be a forward slash
|
||||
if(strpos($this->getInput('u'), "/") === 0) {
|
||||
returnClientError('Remove leading slash "/" from the username!');
|
||||
}
|
||||
|
||||
if(!strpos($this->getInput('u'), "/")) {
|
||||
$html = getSimpleHTMLDOM(self::URI . urlencode($this->getInput('u')) . '?_fb_noscript=1',
|
||||
false,
|
||||
|
|
Loading…
Reference in a new issue