Browse Source

[FacebookBridge] Fix & in URLs

All formats except HTML return & instead of & in URLs causing
all links with parameters (...&id=...) to break.

Facebook does not return valid HTML URIs but instead provides them
with all special characters encoded (like using htmlspecialchars).
This seems to be related to the page being build almost entirely of
script blocks.

This commit adds htmlspecialchars_decode() to URI and content to
reverse the encoding.

References #550
logmanoriginal 6 years ago
parent
commit
cbda060b86
1 changed files with 4 additions and 2 deletions
  1. 4 2
      bridges/FacebookBridge.php

+ 4 - 2
bridges/FacebookBridge.php

@@ -281,9 +281,11 @@ EOD;
 						if(strlen($title) > 64)
 						if(strlen($title) > 64)
 							$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
 							$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
 
 
+						$uri = self::URI . $post->find('abbr')[0]->parent()->getAttribute('href');
+
 						//Build and add final item
 						//Build and add final item
-						$item['uri'] = self::URI . $post->find('abbr')[0]->parent()->getAttribute('href');
-						$item['content'] = $content;
+						$item['uri'] = htmlspecialchars_decode($uri);
+						$item['content'] = htmlspecialchars_decode($content);
 						$item['title'] = $title;
 						$item['title'] = $title;
 						$item['author'] = $author;
 						$item['author'] = $author;
 						$item['timestamp'] = $date;
 						$item['timestamp'] = $date;