Browse Source

Handle relative links to blobs in github readme, fixes #520

Jordi Boggiano 9 years ago
parent
commit
a86f0709d2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/Packagist/WebBundle/Package/Updater.php

+ 2 - 0
src/Packagist/WebBundle/Package/Updater.php

@@ -427,6 +427,8 @@ class Updater
                 $link->setAttribute('rel', 'nofollow');
                 if ('#' === substr($link->getAttribute('href'), 0, 1)) {
                     $link->setAttribute('href', '#user-content-'.substr($link->getAttribute('href'), 1));
+                } elseif (false === strpos($link->getAttribute('href'), '//')) {
+                    $link->setAttribute('href', 'https://github.com/'.$owner.'/'.$repo.'/blob/HEAD/'.$link->getAttribute('href'));
                 }
             }