From df6da837dca4d1f11c9c288f32d81c24b38345e5 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Fri, 23 Mar 2018 21:23:27 +0100 Subject: [PATCH] [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 --- bridges/FacebookBridge.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index 90f3d74c..b0b43249 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -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,