Skip to content

Commit

Permalink
System: remove rawurlencode from FileUpload display (temporary)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKuipers committed Aug 18, 2024
1 parent f78ce0a commit abe1655
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Forms/Input/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,17 @@ protected function getElement()
if (!empty($this->attachments)) {
// jQuery needs brackets in input names escaped, php needs backslashes escaped = double-escaped
$idEscaped = str_replace(['[', ']'], ['\\\\[', '\\\\]'], $this->getID());


foreach ($this->attachments as $attachmentName => $attachmentPath) {

if (!empty($attachmentPath)) {

$output .= '<div class="input-box rounded-sm standardWidth">';

$output .= '<div class="inline-label">';
$output .= __('Current attachment:').'<br/>';
$output .= '<a target="_blank" rel="noopener noreferrer" href="'.$this->absoluteURL.rawurlencode($attachmentPath).'">'.basename($attachmentPath).'</a>';
$output .= '<a target="_blank" rel="noopener noreferrer" href="'.$this->absoluteURL.$attachmentPath.'">'.basename($attachmentPath).'</a>';

global $session;
$absolutePath = $session->get('absolutePath');
Expand All @@ -212,7 +214,7 @@ protected function getElement()

$output .= '</div>';

$output .= "<a download class='inline-button' href='".$this->absoluteURL.rawurlencode($attachmentPath)."'><img title='".__('Download')."' src='./themes/Default/img/download.png'/></a>";
$output .= "<a download class='inline-button' href='".$this->absoluteURL.$attachmentPath."'><img title='".__('Download')."' src='./themes/Default/img/download.png'/></a>";

if ($this->canDelete) {
$attachmentNameEscaped = str_replace(['[', ']'], ['\\\\[', '\\\\]'], $attachmentName);
Expand All @@ -226,7 +228,7 @@ protected function getElement()
$output .= '</div>';
}

$output .= '<input type="hidden" id="'.$attachmentName.'" name="'.$attachmentName.'" value="'.rawurlencode($attachmentPath ?? '').'">';
$output .= '<input type="hidden" id="'.$attachmentName.'" name="'.$attachmentName.'" value="'.($attachmentPath ?? '').'">';
}

if ($this->getAttribute('multiple') == true) {
Expand Down

0 comments on commit abe1655

Please sign in to comment.