Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for showing link to file in email #1228

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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