Prechádzať zdrojové kódy

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

Jordi Boggiano 9 rokov pred
rodič
commit
a86f0709d2

+ 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'));
                 }
             }