Skip to content

Commit

Permalink
Merge pull request from GHSA-v24p-7p4j-qvvf
Browse files Browse the repository at this point in the history
* Encode file names in tooltips and titles

* Remove ampersands in sanitizeFileName()

* Revert "Remove ampersands in sanitizeFileName()"

This reverts commit 81d06fe1ba46a969f5eacfa1420a8519379e0262.

---------

Co-authored-by: Leo Feyer <1192057+leofeyer@users.noreply.github.com>
  • Loading branch information
ausi and leofeyer committed Apr 9, 2024
1 parent 388859d commit b794e14
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core-bundle/src/Resources/contao/drivers/DC_Folder.php
Expand Up @@ -2720,7 +2720,7 @@ protected function generateTree($path, $intMargin, $mount=false, $blnProtected=t
$folderAlt = $protected ? $GLOBALS['TL_LANG']['MSC']['folderCP'] : $GLOBALS['TL_LANG']['MSC']['folderC'];

// Add the current folder
$strFolderNameEncoded = StringUtil::convertEncoding(StringUtil::specialchars(basename($currentFolder)), System::getContainer()->getParameter('kernel.charset'));
$strFolderNameEncoded = StringUtil::convertEncoding(StringUtil::specialchars(basename($currentFolder), false, true), System::getContainer()->getParameter('kernel.charset'));
$return .= Image::getHtml($folderImg, $folderAlt) . ' <a href="' . $this->addToUrl('fn=' . $currentEncoded) . '" title="' . StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']) . '"><strong>' . $strFolderNameEncoded . '</strong></a></div> <div class="tl_right">';

// Paste buttons
Expand Down Expand Up @@ -2842,7 +2842,7 @@ protected function generateTree($path, $intMargin, $mount=false, $blnProtected=t
}
}

$strFileNameEncoded = StringUtil::convertEncoding(StringUtil::specialchars(basename($currentFile)), System::getContainer()->getParameter('kernel.charset'));
$strFileNameEncoded = StringUtil::convertEncoding(StringUtil::specialchars(basename($currentFile), false, true), System::getContainer()->getParameter('kernel.charset'));
$iconAlt = sprintf($GLOBALS['TL_LANG']['MSC']['typeOfFile'], strtoupper($objFile->extension));

// No popup links for protected files and templates (see #700)
Expand Down
6 changes: 3 additions & 3 deletions core-bundle/src/Resources/public/core.js
Expand Up @@ -977,7 +977,7 @@ var Backend =
'onHide': function() { document.body.setStyle('overflow', 'auto'); }
});
M.show({
'title': opt.title,
'title': opt.title && opt.title.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'),
'contents': '<img src="' + opt.url + '" alt="">'
});
},
Expand All @@ -1002,7 +1002,7 @@ var Backend =
'onHide': function() { document.body.setStyle('overflow', 'auto'); }
});
M.show({
'title': opt.title,
'title': opt.title && opt.title.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'),
'contents': '<iframe src="' + opt.url + '" width="100%" height="' + opt.height + '" frameborder="0"></iframe>',
'model': 'modal'
});
Expand Down Expand Up @@ -1092,7 +1092,7 @@ var Backend =
this.hide();
});
M.show({
'title': opt.title,
'title': opt.title && opt.title.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'),
'contents': '<iframe src="' + opt.url + '" name="simple-modal-iframe" width="100%" height="' + opt.height + '" frameborder="0"></iframe>',
'model': 'modal'
});
Expand Down
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/public/core.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions core-bundle/src/Resources/public/mootao.js
Expand Up @@ -179,6 +179,11 @@ Tips.Contao = new Class(
this.tip.setStyles(obj);
},

fill: function(element, contents){
if (typeof contents == 'string') element.set(element.hasClass('tip-text') ? 'html' : 'text', contents);
else element.adopt(contents);
},

hide: function(element) {
if (!this.tip) document.id(this);
this.fireEvent('hide', [this.tip, element]);
Expand Down
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/public/mootao.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b794e14

Please sign in to comment.