Skip to content

Commit

Permalink
fix: Fix duplicate file detection
Browse files Browse the repository at this point in the history
  • Loading branch information
famoser committed Sep 18, 2023
1 parent d1c45b7 commit f071f85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Service/Report/Pdf/PdfService.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ public function generatePdfReport(array $issues, Filter $filter, ReportElements

$sanitizedConstructionSiteName = FileHelper::sanitizeFileName($constructionSite->getName());
$humanReadablePrefix = (new \DateTime())->format(DateTimeFormatter::FILESYSTEM_DATE_TIME_FORMAT).'_'.$sanitizedConstructionSiteName;

$optimalFilename = $humanReadablePrefix.'.pdf';
$filename = file_exists($optimalFilename) ? $humanReadablePrefix.'_'.uniqid().'.pdf' : $optimalFilename;
$optimalPath = $folder.'/'.$optimalFilename;
$filename = file_exists($optimalPath) ? $humanReadablePrefix.'_'.uniqid().'.pdf' : $optimalFilename;

$path = $folder.'/'.$filename;
$report->save($path);
Expand Down

0 comments on commit f071f85

Please sign in to comment.