Skip to content

Commit fb01633

Browse files
committed
Problem resolving absolute URLs
1 parent 8aac1bf commit fb01633

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

CssCrush/lib/Importer.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ public static function hostfile ( $hostfile ) {
5555
}
5656

5757
$import = new stdClass;
58-
$import->name = $url;
58+
$import->name = $url;
5959
$import->mediaContext = $mediaContext;
60-
$import->path = "$hostfile->dir/$import->name";
61-
$import->content = @file_get_contents( $import->path );
60+
if ( strpos( $import->name, '/' ) === 0 ) {
61+
$import->path = $config->docRoot . $import->name;
62+
}
63+
else {
64+
$import->path = "$hostfile->dir/$import->name";
65+
}
66+
67+
$import->content = @file_get_contents( $import->path );
6268

6369
// Failed to open import, just continue with the import line removed
6470
if ( !$import->content ) {

0 commit comments

Comments
 (0)