feat: dummy replacement pdf upload for environments other than prod

This commit is contained in:
Björn Fromme committed 2026-03-15 12:42:28 +01:00
1 parent 3b99757a08
commit 8988ae7620
12 files changed
+78 -16

No files matched your search

+23
View File
@@ -22,6 +22,8 @@ class UploadHandler
private readonly Sanitizer $sanitizer,
private readonly LoggerInterface $logger,
private readonly string $projectDir,
private readonly string $environment,
private readonly string $uploadReplacementFile,
) {
}
@@ -143,6 +145,27 @@ class UploadHandler
return true === $absolute ? sprintf('%s/%s', $this->projectDir, $relativePath) : $relativePath;
}
/**
* Returns the upload file path, substituting a replacement file in non-production environments
* when configured. Use this for read-only access (downloads, email attachments).
*/
public function getResolvedUploadFilepath(Upload $upload): string
{
$originalPath = $this->getUploadFilepath($upload);
if ('' === $this->uploadReplacementFile || 'prod' === $this->environment) {
return $originalPath;
}
$replacementPath = sprintf('%s/%s', $this->projectDir, $this->uploadReplacementFile);
if (false === file_exists($replacementPath)) {
return $originalPath;
}
return $replacementPath;
}
public function getTempUploadFilepath(UploadDto $uploadDto, string $uploadSessionId): string
{
$tempUploadDir = $this->getTempUploadDir($uploadSessionId);