From 8078ee08f2726677c52860ad154d1f3c1adf3208 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Wed, 28 Jun 2017 16:59:41 +1200 Subject: [PATCH] BUG Fix folder urls getting mtime querystring appended --- src/Control/SimpleResourceURLGenerator.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Control/SimpleResourceURLGenerator.php b/src/Control/SimpleResourceURLGenerator.php index 30375a7be..169237e98 100644 --- a/src/Control/SimpleResourceURLGenerator.php +++ b/src/Control/SimpleResourceURLGenerator.php @@ -2,6 +2,7 @@ namespace SilverStripe\Control; +use InvalidArgumentException; use SilverStripe\Core\Manifest\ResourceURLGenerator; /** @@ -30,6 +31,7 @@ class SimpleResourceURLGenerator implements ResourceURLGenerator * Currently only "mtime" is allowed * * @param string|null $nonceStyle The style of nonces to apply, or null to disable + * @return $this */ public function setNonceStyle($nonceStyle) { @@ -37,6 +39,7 @@ class SimpleResourceURLGenerator implements ResourceURLGenerator throw new InvalidArgumentException('The only allowed NonceStyle is mtime'); } $this->nonceStyle = $nonceStyle; + return $this; } /** @@ -55,7 +58,8 @@ class SimpleResourceURLGenerator implements ResourceURLGenerator } $nonce = ''; - if ($this->nonceStyle) { + // Don't add nonce to directories + if ($this->nonceStyle && is_file($absolutePath)) { $nonce = (strpos($relativePath, '?') === false) ? '?' : '&'; switch ($this->nonceStyle) {