mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-10 07:02:13 +00:00
Show HTML files in the HTML sandbox if enabled
This commit is contained in:
parent
63dd344c02
commit
4a5cc454ce
3 changed files with 50 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Attachments;
|
||||
|
||||
use App\Settings\SystemSettings\AttachmentsSettings;
|
||||
use Imagine\Exception\RuntimeException;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use InvalidArgumentException;
|
||||
|
|
@ -40,7 +41,7 @@ class AttachmentURLGenerator
|
|||
|
||||
public function __construct(protected Packages $assets, protected AttachmentPathResolver $pathResolver,
|
||||
protected UrlGeneratorInterface $urlGenerator, protected AttachmentManager $attachmentHelper,
|
||||
protected CacheManager $thumbnailManager, protected LoggerInterface $logger)
|
||||
protected CacheManager $thumbnailManager, protected LoggerInterface $logger, private readonly AttachmentsSettings $attachmentsSettings)
|
||||
{
|
||||
//Determine a normalized path to the public folder (assets are relative to this folder)
|
||||
$this->public_path = $this->pathResolver->parameterToAbsolutePath('public');
|
||||
|
|
@ -99,6 +100,10 @@ class AttachmentURLGenerator
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($this->attachmentsSettings->showHTMLAttachments && $attachment->isLocalHTMLFile()) {
|
||||
return $this->urlGenerator->generate('attachment_html_sandbox', ['id' => $attachment->getID()]);
|
||||
}
|
||||
|
||||
$asset_path = $this->absolutePathToAssetPath($absolute_path);
|
||||
//If path is not relative to public path or marked as secure, serve it via controller
|
||||
if (null === $asset_path || $attachment->isSecure()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue