Skip to content

Commit af6a2e5

Browse files
authored
Merge pull request #8 from jensscherbl/master
Fixes issue with unreliable parse_url for relative URIs
2 parents 25cb4e8 + c36b281 commit af6a2e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tokens/tag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ public function minify(array $minify) : void {
430430
if ($minify['urls'] && $attributes[$key] && \in_array($key, $attr['urls'], true) && (!\in_array($tag, \array_keys($attr['urlskip']), true) || $this->hasAttribute($attributes, $attr['urlskip'][$tag]))) {
431431

432432
// make folder variables
433-
if ($folder === null && isset($_SERVER['REQUEST_URI'])) {
434-
if (($folder = \parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)) !== null) {
433+
if ($folder === null && isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
434+
if (($folder = \parse_url('//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], PHP_URL_PATH)) !== null) {
435435
if (\mb_substr($folder, -1) !== '/') {
436436
$folder = \dirname($folder).'/';
437437
}

0 commit comments

Comments
 (0)