You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$this->setHelp('This command allows to sanitize SVG files uploaded via attachments. This happens automatically since version 1.17.1, this command is intended to be used for older files.');
46
+
}
47
+
48
+
protectedfunctionexecute(InputInterface$input, OutputInterface$output): int
49
+
{
50
+
$io = newSymfonyStyle($input, $output);
51
+
52
+
$io->info('This command will sanitize all uploaded SVG files. This is only required if you have uploaded (untrusted) SVG files before version 1.17.1. If you are running a newer version, you don\'t need to run this command (again).');
53
+
if (!$io->confirm('Do you want to continue?', false)) {
54
+
$io->success('Command aborted.');
55
+
return Command::FAILURE;
56
+
}
57
+
58
+
$io->info('Sanitizing SVG files...');
59
+
60
+
//Finding all attachments with svg files
61
+
$qb = $this->entityManager->createQueryBuilder();
62
+
$qb->select('a')
63
+
->from(Attachment::class, 'a')
64
+
->where('a.internal_path LIKE :pattern ESCAPE \'#\'')
65
+
->orWhere('a.original_filename LIKE :pattern ESCAPE \'#\'')
66
+
->setParameter('pattern', '%.svg');
67
+
68
+
$attachments = $qb->getQuery()->getResult();
69
+
$io->note('Found '.count($attachments).' attachments with SVG files.');
0 commit comments