From 680bfef2c31fd35724d47e3d26e24beb7b9e8ca1 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Tue, 8 Jan 2019 05:28:56 +0100 Subject: [PATCH 1/4] http to https (#2299) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5a5c6a80c..d56945e20 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "project", "description": "Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS", "keywords": ["cms","flat-file cms","flat cms","flatfile cms","php"], - "homepage": "http://getgrav.org", + "homepage": "https://getgrav.org", "license": "MIT", "require": { "php": ">=5.6.4", From 394dfad566110f76bce126afcae10b0023e88355 Mon Sep 17 00:00:00 2001 From: ranitham Date: Tue, 8 Jan 2019 15:34:00 +1100 Subject: [PATCH 2/4] Small bugfix for responsive images (#2300) * Replace spaces in image filename with %20 to avoid parse errors with the srcset attribute * Update system/src/Grav/Common/Page/Medium/ImageMedium.php Co-Authored-By: ranitham --- system/src/Grav/Common/Page/Medium/ImageMedium.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 2f1f176a6..72f23b4fd 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -223,7 +223,7 @@ class ImageMedium extends Medium foreach ($this->alternatives as $ratio => $medium) { $srcset[] = $medium->url($reset) . ' ' . $medium->get('width') . 'w'; } - $srcset[] = $this->url($reset) . ' ' . $this->get('width') . 'w'; + $srcset[] = str_replace(' ', '%20', $this->url($reset)) . ' ' . $this->get('width') . 'w'; return implode(', ', $srcset); } From e8825beae5951e511580bfc5b9c058fa9ae51e2c Mon Sep 17 00:00:00 2001 From: "Basile Trujillo [L0gIn]" Date: Wed, 9 Jan 2019 21:04:32 +0100 Subject: [PATCH 3/4] Added support for AWS Cloudfront forwarded scheme header (#2297) AWS Cloudfront does not provide HTTP_X_FORWARDED_PROTO header but provide a HTTP_CLOUDFRONT_FORWARDED_PROTO header instead --- system/src/Grav/Common/Uri.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 9ce2d423d..f1a46f87f 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -1140,6 +1140,8 @@ class Uri $this->scheme = $env['HTTP_X_FORWARDED_PROTO']; } elseif (isset($env['X-FORWARDED-PROTO'])) { $this->scheme = $env['X-FORWARDED-PROTO']; + } elseif (isset($env['HTTP_CLOUDFRONT_FORWARDED_PROTO'])) { + $this->scheme = $env['HTTP_CLOUDFRONT_FORWARDED_PROTO']; } elseif (isset($env['REQUEST_SCHEME'])) { $this->scheme = $env['REQUEST_SCHEME']; } else { @@ -1168,6 +1170,10 @@ class Uri $this->port = (int)$env['HTTP_X_FORWARDED_PORT']; } elseif (isset($env['X-FORWARDED-PORT'])) { $this->port = (int)$env['X-FORWARDED-PORT']; + } elseif (isset($env['HTTP_CLOUDFRONT_FORWARDED_PROTO'])) { + // Since AWS Cloudfront does not provide a forwarded port header, + // we have to build the port using the scheme. + $this->port = $this->port(); } elseif (isset($env['SERVER_PORT'])) { $this->port = (int)$env['SERVER_PORT']; } else { From f1363877d8782fbceb4dd53d38d538f57b7104de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Wed, 9 Jan 2019 17:05:32 -0300 Subject: [PATCH 4/4] preserve accents in fields containing Twig expr. using unicode (#2279) When a fields contain accentuated characters, reduce the risk of messing with it by passing unicode characters unescaped. Twig will deal with them. And fewer backslash-escaping problems will arise. --- system/src/Grav/Common/Page/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 3024cc394..0e57b0344 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -168,7 +168,7 @@ class Page implements PageInterface unset($process_fields[$field]); } } - $text_header = Grav::instance()['twig']->processString(json_encode($process_fields), ['page' => $this]); + $text_header = Grav::instance()['twig']->processString(json_encode($process_fields, JSON_UNESCAPED_UNICODE), ['page' => $this]); $this->header((object)(json_decode($text_header, true) + $ignored_fields)); } }