BUG Fix folder urls getting mtime querystring appended

This commit is contained in:
Damian Mooyman 2017-06-28 16:59:41 +12:00
parent 741166e369
commit 8078ee08f2
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
1 changed files with 5 additions and 1 deletions

View File

@ -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) {