mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-12-24 06:49:29 -05:00
clarify use of cache buster, avoid using regex
This commit is contained in:
parent
3c6df4573e
commit
4b6c8356f5
@ -69,10 +69,11 @@ class View
|
||||
{
|
||||
$sri = array_key_exists($file, $this->_variables['SRI']) ?
|
||||
' integrity="' . $this->_variables['SRI'][$file] . '"' : '';
|
||||
$suffix = preg_match('#\d.js$#', $file) == 0 ?
|
||||
'?' . rawurlencode($this->_variables['VERSION']) : '';
|
||||
// if the file isn't versioned (ends in a digit), add our own version
|
||||
$cacheBuster = ctype_digit(substr($file, -4, 1)) ?
|
||||
'' : '?' . rawurlencode($this->_variables['VERSION']);
|
||||
echo '<script ', $attributes,
|
||||
' type="text/javascript" data-cfasync="false" src="', $file,
|
||||
$suffix, '"', $sri, ' crossorigin="anonymous"></script>', PHP_EOL;
|
||||
$cacheBuster, '"', $sri, ' crossorigin="anonymous"></script>', PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Exception;
|
||||
use GlobIterator;
|
||||
use Google\Cloud\Core\Exception\BadRequestException;
|
||||
use Google\Cloud\Core\Exception\NotFoundException;
|
||||
use Google\Cloud\Storage\Bucket;
|
||||
|
Loading…
Reference in New Issue
Block a user