Use standard temporary file for internal use of HTMLPurifier (#2383)

This commit is contained in:
Vladislav Lyshenko 2021-11-23 16:45:43 +02:00 committed by GitHub
parent a2be574f36
commit 9dcfd9a5c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Added
- Nothing
- Use tmp dir in HTMLPurifier config
### Changed

View File

@ -1769,6 +1769,10 @@ class Html extends BaseWriter
$result = '';
if (!$this->isPdf && isset($worksheet->getComments()[$coordinate])) {
$sanitizer = new HTMLPurifier();
$cachePath = File::sysGetTempDir() . '/phpsppur';
if (is_dir($cachePath) || mkdir($cachePath)) {
$sanitizer->config->set('Cache.SerializerPath', $cachePath);
}
$sanitizedString = $sanitizer->purify($worksheet->getComment($coordinate)->getText()->getPlainText());
if ($sanitizedString !== '') {
$result .= '<a class="comment-indicator"></a>';