Language Change NPM Resource Changed bug PR-4.3-dev ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
19 Aug 2022

Pull Request for Issue #38068 and #38530 .

Summary of Changes

Improve error handling in MediaManager

Testing Instructions

Apply patch. Run npm install.
Try upload something not allowed in to mediamanager.

Actual result BEFORE applying this Pull Request

General error Unable to upload file.

Expected result AFTER applying this Pull Request

General error Unable to upload file.
Then multiple detailed errors:
Or Illegal mime type detected or This file type is not supported (depend from medimanager config)
Or for svg: The file looks suspicious, therefore cannot be uploaded

Documentation Changes Required

nope

@brianteeman please review an updated string.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar Fedik Fedik - open - 19 Aug 2022
avatar Fedik Fedik - change - 19 Aug 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Aug 2022
Category JavaScript Administration com_media NPM Change Language & Strings
b5feda2 19 Aug 2022 avatar Fedik jscs
avatar Fedik Fedik - change - 19 Aug 2022
Labels Added: Language Change NPM Resource Changed ?
avatar laoneo
laoneo - comment - 19 Aug 2022

Nice one as it will catch on every request the error messages.

avatar obuisard
obuisard - comment - 19 Aug 2022

Thank you for providing a better solution!

avatar brianteeman
brianteeman - comment - 21 Aug 2022

even better would be to display the error message from the svgsanitizer which explains exactly why the file was rejected

avatar obuisard
obuisard - comment - 30 Aug 2022

I have added documentation about uploading SVG files. You can find it at https://docs.joomla.org/J4.x:Media:_Uploading_SVG_files. It may need refining and additional content. You are welcome to pitch in, thank you!

avatar brianteeman
brianteeman - comment - 14 Mar 2023

IT does what it says but I wonder why we have the two messages. The second one makes the first one redundant?

image

avatar Fedik
Fedik - comment - 14 Mar 2023

The script render all messages that was sent from PHP backend.
In your example, I guess the first one comes from a controller, and second one from a validator.

avatar brianteeman brianteeman - test_item - 14 Mar 2023 - Tested successfully
avatar brianteeman
brianteeman - comment - 14 Mar 2023

I have tested this item successfully on b5feda2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38536.

avatar Fedik
Fedik - comment - 14 Mar 2023

Before the fix, the script was rendered only first message, and rest were ignored.

avatar joomdonation
joomdonation - comment - 20 Mar 2023

In your example, I guess the first one comes from a controller, and second one from a validator

The first message is from the Exception https://github.com/joomla/joomla-cms/blob/4.2-dev/plugins/filesystem/local/src/Adapter/LocalAdapter.php#L772 , additional messages are Joomla system messages generated by calling $app->enqueueMessage from canUpload from MediaHelper https://github.com/joomla/joomla-cms/blob/4.2-dev/libraries/src/Helper/MediaHelper.php#L200

Still the first error message is redundant as Brian said. Is it OK to make the Exception https://github.com/joomla/joomla-cms/blob/4.2-dev/plugins/filesystem/local/src/Adapter/LocalAdapter.php#L772 with empty message, and have the Joomla system messages rendered for this case ? It is kind of workaround but more user friendly.

avatar Fedik
Fedik - comment - 20 Mar 2023

Is it OK to make the Exception with empty message

I do not think.
I think the root issue that $helper->canUpload() should return boolean and cannot throw an exception, so someone decided to put all in to $app->enqueueMessage . Not perfect, but working.

avatar joomdonation joomdonation - test_item - 24 Mar 2023 - Tested successfully
avatar joomdonation
joomdonation - comment - 24 Mar 2023

I have tested this item successfully on b5feda2

Not perfect but work.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38536.

avatar joomdonation joomdonation - change - 24 Mar 2023
Status Pending Ready to Commit
avatar joomdonation
joomdonation - comment - 24 Mar 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38536.

avatar AmyKrizanWang
AmyKrizanWang - comment - 20 Apr 2023

For Header logo fixer:
How to get Joomla4 with Cassiopeia Template to work

J4 dashboard > Content > Media > Create a new Folder "svgs"
ftp upload your svg logo file to this folder
/var/www/html/images/svgs/upload the logo

Topright "Options" in the Media
Allowed Extensions > add > "svg,SVG"
Legal Image Extensions (File Types) > add > "svg"
Legal MIME Types > add > ",image/svg+xml,application/svg+xml"

SAVE

J4 dashboard > System > Templates > Site Template Styles > Cassiopeia - Default >

/images/svgs/header-logo.svg

Tagline (this is a must-step):
i have added 20x The &nbsp entity " "

SAVE

I will update once i have a fixer for the Footer svg file ;-)

avatar brianteeman
brianteeman - comment - 20 Apr 2023

@AmyKrizanWang please do not update your comment. It is nothing to do with this issue.

avatar HLeithner
HLeithner - comment - 2 May 2023

This pull request has been automatically rebased to 4.3-dev.

avatar Fedik Fedik - change - 3 May 2023
Labels Added: ? bug
avatar Fedik Fedik - change - 3 May 2023
Status Ready to Commit Pending
avatar Fedik
Fedik - comment - 3 May 2023

Pleas test it again, there was a complex conflict, I had to redo changes.

avatar Quy Quy - change - 21 Jul 2023
Labels Added: PR-4.3-dev ?
Removed: ? ?
avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 4.4-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
MediaManager: improve error handling
[4.4] MediaManager: improve error handling
avatar HLeithner HLeithner - edited - 24 Apr 2024

Add a Comment

Login with GitHub to post a comment