From 2e6cbd1ce7510bd7fde874a593b1c519a156d6cb Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sat, 3 Nov 2018 11:52:31 +0100 Subject: [PATCH] [GitHubGistBridge] Fix broken bridge `defaultLinkTo` makes anchors point to the correct path which broke parsing because it expected href to start with `#gistcomment`. This commit changes the implementation to make `defaultLinkTo` point to the correct page (using `getURI` instead of `self::URI`) and search with `*=` instead of `^=`. --- bridges/GitHubGistBridge.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridges/GitHubGistBridge.php b/bridges/GitHubGistBridge.php index 6abd2ecd..98e40800 100644 --- a/bridges/GitHubGistBridge.php +++ b/bridges/GitHubGistBridge.php @@ -54,7 +54,7 @@ class GitHubGistBridge extends BridgeAbstract { DEFAULT_SPAN_TEXT) or returnServerError('Could not request ' . $this->getURI()); - $html = defaultLinkTo($html, static::URI); + $html = defaultLinkTo($html, $this->getURI()); $fileinfo = $html->find('[class="file-info"]', 0) or returnServerError('Could not find file info!'); @@ -69,7 +69,7 @@ class GitHubGistBridge extends BridgeAbstract { foreach($comments as $comment) { - $uri = $comment->find('a[href^=#gistcomment]', 0) + $uri = $comment->find('a[href*=#gistcomment]', 0) or returnServerError('Could not find comment anchor!'); $title = $comment->find('div[class="unminimized-comment"] h3[class="timeline-comment-header-text"]', 0) @@ -86,7 +86,7 @@ class GitHubGistBridge extends BridgeAbstract { $item = array(); - $item['uri'] = $this->getURI() . $uri->href; + $item['uri'] = $uri->href; $item['title'] = str_replace('commented', 'commented on', $title->plaintext); $item['timestamp'] = strtotime($datetime->datetime); $item['author'] = '' . $author->plaintext . '';