aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-02-05 06:31:19 +0100
committerChristian Weiske <cweiske@cweiske.de>2014-02-05 06:31:42 +0100
commitc3809e6b58401ccbdcae2fb6ab67010d4e6cfb90 (patch)
tree97e766bfca67e2257e295e9a447616eeaf687f50 /src
parent1e852867ef61f99a5b96369b986b9a858310af56 (diff)
downloadphorkie-c3809e6b58401ccbdcae2fb6ab67010d4e6cfb90.tar.gz
phorkie-c3809e6b58401ccbdcae2fb6ab67010d4e6cfb90.zip
Fix #43: gist.github.com URLs with usernames
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/HtmlParser.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/phorkie/HtmlParser.php b/src/phorkie/HtmlParser.php
index f751074..6b5d26a 100644
--- a/src/phorkie/HtmlParser.php
+++ b/src/phorkie/HtmlParser.php
@@ -44,9 +44,17 @@ class HtmlParser
if ($scheme == 'https' && isset($arUrl['host'])
&& $arUrl['host'] == 'gist.github.com'
) {
+ //https://gist.github.com/maddy2101/5764473
+ $parts = explode('/', ltrim($arUrl['path'], '/'));
+ if (count($parts == 2)) {
+ //we only want the number, not the user name
+ $path = $parts[1];
+ } else {
+ $path = ltrim($arUrl['path'], '/');
+ }
//FIXME: title
$this->arGitUrls[][] = 'git://gist.github.com/'
- . ltrim($arUrl['path'], '/') . '.git';
+ . $path . '.git';
return true;
}