Skip to content

Commit

Permalink
fix for showing link to file in email, as submitted by non-authentica…
Browse files Browse the repository at this point in the history
…ted person (fixes #1225)
  • Loading branch information
baukezwaan committed Aug 11, 2023
1 parent 98cfb16 commit 88cc505
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/Model/Submission/SubmittedFileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace SilverStripe\UserForms\Model\Submission;

use SilverStripe\Assets\File;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\UserForms\Control\UserDefinedFormController;
use SilverStripe\Versioned\Versioned;

/**
Expand Down Expand Up @@ -32,7 +34,7 @@ class SubmittedFileField extends SubmittedFormField

/**
* Return the value of this field for inclusion into things such as
* reports.
* reports and email.
*
* @return string
*/
Expand All @@ -45,7 +47,7 @@ public function getFormattedValue()
$file = $this->getUploadedFileFromDraft();

if ($link) {
if ($file->canView()) {
if ($file->canView() || Controller::curr() instanceof UserDefinedFormController) {
return DBField::create_field('HTMLText', sprintf(
'%s - <a href="%s" target="_blank">%s</a>',
htmlspecialchars($name, ENT_QUOTES),
Expand Down

0 comments on commit 88cc505

Please sign in to comment.