fix deleting invoice documents (#2980)

This commit is contained in:
Kevin Papst
2021-11-29 15:57:39 +01:00
committed by GitHub
parent d994339de5
commit 9491f07ade
3 changed files with 9 additions and 5 deletions

View File

@@ -55,7 +55,11 @@ final class InvoiceDocumentRepository
*/
public function remove(InvoiceDocument $invoiceDocument): void
{
@unlink($invoiceDocument->getFilename());
if (stripos($invoiceDocument->getFilename(), $this->getUploadDirectory()) === false) {
throw new \InvalidArgumentException('Cannot delete built-in invoice template');
}
@unlink(realpath($invoiceDocument->getFilename()));
}
/**