mirror of https://github.com/joomla/joomla-cms.git
[4.4] [bug] Media manager misbehaves on files with capitalized extensions (#43336)
* a * b * Update LocalAdapter.php
This commit is contained in:
parent
43293d0603
commit
bd6ca75b4e
|
@ -173,7 +173,7 @@ class Edit {
|
|||
* Public
|
||||
*/
|
||||
upload(url, stateChangeCallback) {
|
||||
let format = Joomla.MediaManager.Edit.original.extension === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension;
|
||||
let format = Joomla.MediaManager.Edit.original.extension.toLowerCase() === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension.toLowerCase();
|
||||
|
||||
if (!format) {
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
|
|
|
@ -49,7 +49,7 @@ const init = (image) => {
|
|||
formElements.cropY.value = Math.round(e.detail.y);
|
||||
formElements.cropWidth.value = Math.round(e.detail.width);
|
||||
formElements.cropHeight.value = Math.round(e.detail.height);
|
||||
const format = Joomla.MediaManager.Edit.original.extension === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension;
|
||||
const format = Joomla.MediaManager.Edit.original.extension.toLowerCase() === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension.toLowerCase();
|
||||
const quality = formElements.cropQuality.value;
|
||||
|
||||
// Update the store
|
||||
|
|
|
@ -14,7 +14,7 @@ const resize = (width, height, image) => {
|
|||
canvas.getContext('2d').drawImage(image, 0, 0, width, height);
|
||||
|
||||
// The format
|
||||
const format = Joomla.MediaManager.Edit.original.extension === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension;
|
||||
const format = Joomla.MediaManager.Edit.original.extension.toLowerCase() === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension.toLowerCase();
|
||||
|
||||
// The quality
|
||||
const quality = formElements.resizeQuality.value;
|
||||
|
|
|
@ -28,7 +28,7 @@ const rotate = (angle, image) => {
|
|||
ctx.drawImage(image, -image.naturalWidth / 2, -image.naturalHeight / 2);
|
||||
|
||||
// The format
|
||||
const format = Joomla.MediaManager.Edit.original.extension === 'jpg' ? 'jpeg' : 'jpg';
|
||||
const format = Joomla.MediaManager.Edit.original.extension.toLowerCase() === 'jpg' ? 'jpeg' : Joomla.MediaManager.Edit.original.extension.toLowerCase();
|
||||
|
||||
// The quality
|
||||
const quality = document.getElementById('jform_rotate_quality').value;
|
||||
|
|
|
@ -240,6 +240,9 @@ class MediaHelper
|
|||
$executables = array_diff($executables, $allowedExecutables);
|
||||
}
|
||||
|
||||
// Ensure lowercase extension
|
||||
$filetypes = array_map('strtolower', $filetypes);
|
||||
|
||||
$check = array_intersect($filetypes, $executables);
|
||||
|
||||
if (!empty($check)) {
|
||||
|
|
|
@ -818,7 +818,7 @@ class LocalAdapter implements AdapterInterface
|
|||
$helper = new MediaHelper();
|
||||
|
||||
// @todo find a better way to check the input, by not writing the file to the disk
|
||||
$tmpFile = Path::clean(dirname($localPath) . '/' . uniqid() . '.' . File::getExt($name));
|
||||
$tmpFile = Path::clean(\dirname($localPath) . '/' . uniqid() . '.' . strtolower(File::getExt($name)));
|
||||
|
||||
if (!File::write($tmpFile, $mediaContent)) {
|
||||
throw new \Exception(Text::_('JLIB_MEDIA_ERROR_UPLOAD_INPUT'), 500);
|
||||
|
|
Loading…
Reference in New Issue