Skip to content

Commit 5bc137d

Browse files
authored
Merge pull request #7633 from BrickOzp/attachmentampersand
Fix attachment names with ampersand
2 parents 8d114ae + 02e1e18 commit 5bc137d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Subs-Attachments.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,12 +1194,12 @@ function loadAttachmentContext($id_msg, $attachments)
11941194
{
11951195
$attachmentData[$i] = array(
11961196
'id' => $attachment['id_attach'],
1197-
'name' => preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', $smcFunc['htmlspecialchars']($attachment['filename'])),
1197+
'name' => preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', $smcFunc['htmlspecialchars'](un_htmlspecialchars($attachment['filename']))),
11981198
'downloads' => $attachment['downloads'],
11991199
'size' => ($attachment['filesize'] < 1024000) ? round($attachment['filesize'] / 1024, 2) . ' ' . $txt['kilobyte'] : round($attachment['filesize'] / 1024 / 1024, 2) . ' ' . $txt['megabyte'],
12001200
'byte_size' => $attachment['filesize'],
12011201
'href' => $scripturl . '?action=dlattach;attach=' . $attachment['id_attach'],
1202-
'link' => '<a href="' . $scripturl . '?action=dlattach;attach=' . $attachment['id_attach'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars']($attachment['filename']) . '</a>',
1202+
'link' => '<a href="' . $scripturl . '?action=dlattach;attach=' . $attachment['id_attach'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](un_htmlspecialchars($attachment['filename'])) . '</a>',
12031203
'is_image' => !empty($attachment['width']) && !empty($attachment['height']),
12041204
'is_approved' => $attachment['approved'],
12051205
'topic' => $attachment['topic'],

0 commit comments

Comments
 (0)