mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 18:21:40 -04:00
Merge pull request #16096 from nextcloud/backport/16021/fall-back-to-black-for-non-color-values
[stable14] Fall back to black for non-color values
This commit is contained in:
commit
1345ad85be
1 changed files with 7 additions and 1 deletions
|
|
@ -92,7 +92,7 @@ class SvgController extends Controller {
|
|||
// e.g /var/www/html/custom_apps/contacts
|
||||
// or outside root /var/www/apps/files
|
||||
$appRootPath = $this->appManager->getAppPath($app);
|
||||
|
||||
|
||||
if (!$appRootPath) {
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
|
@ -106,6 +106,7 @@ class SvgController extends Controller {
|
|||
*
|
||||
* @param string $path
|
||||
* @param string $color
|
||||
* @param string $fileName
|
||||
* @return DataDisplayResponse|NotFoundResponse
|
||||
*/
|
||||
private function getSvg(string $path, string $color, string $fileName) {
|
||||
|
|
@ -119,6 +120,11 @@ class SvgController extends Controller {
|
|||
return new NotFoundResponse();
|
||||
}
|
||||
|
||||
if (!preg_match('/^[0-9a-f]{3,6}$/i', $color)) {
|
||||
// Prevent not-sane colors from being written into the SVG
|
||||
$color = '000';
|
||||
}
|
||||
|
||||
// add fill (fill is not present on black elements)
|
||||
$fillRe = '/<((circle|rect|path)((?!fill)[a-z0-9 =".\-#():;])+)\/>/mi';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue