PR-5.2-dev PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar hiteshm0
hiteshm0
16 Mar 2025

Pull Request for Issue # .
#45087

Summary of Changes

  1. Change in LocalAdapter.php : the move function has been updated to fix the bug

Testing Instructions

testing instructions has been given in the issue this PR is trying to fix ( #45087 )
[
Go to Content - Media
Mark one image and use "Rename"
Add to the file name some "$" - characters and press "Save" ( or other characters such as # etc )
]

Actual result BEFORE applying this Pull Request

when a filename including symbols such as $ , ! is renamed it throws 2 errors , 1) "Error renaming item" ( which is correct )
2) move file is not possible as destination already exists ( which is incorrect and inconvenient to the user as it is not stating the correct reason for the error being thrown )

Expected result AFTER applying this Pull Request

error 2 is replaced by :
"File name must only have alphanumeric characters and no spaces."

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar hiteshm0 hiteshm0 - change - 16 Mar 2025
Status New Pending
avatar hiteshm0 hiteshm0 - open - 16 Mar 2025
avatar joomla-cms-bot joomla-cms-bot - change - 16 Mar 2025
Category Administration Language & Strings Front End Plugins
avatar hiteshm0 hiteshm0 - change - 16 Mar 2025
Labels Added: Language Change PR-5.2-dev
avatar fgsw
fgsw - comment - 16 Mar 2025

@hiteshm0 Suggested title "[5.2] Fix where an error failing explain the correct reason for failure to rename a file is being thrown".

Personal i don't understand the title, but that may belong to my english skills. So i suggest only the unneeded informations.

avatar hiteshm0 hiteshm0 - change - 16 Mar 2025
Title
bug fix : issue #45087 , PR tries to fix a bug where an error failing explain the correct reason for failure to rename a file is being thrown.
bug fix : issue #45087 , PR tries to fix a bug where an error failing to explain the correct reason for failure to rename a file is being thrown.
avatar hiteshm0 hiteshm0 - edited - 16 Mar 2025
avatar hiteshm0 hiteshm0 - change - 16 Mar 2025
Title
bug fix : issue #45087 , PR tries to fix a bug where an error failing to explain the correct reason for failure to rename a file is being thrown.
[5.2] fix where an error failing to explain the correct reason for failure to rename a file is being thrown.
avatar hiteshm0 hiteshm0 - edited - 16 Mar 2025
avatar hiteshm0
hiteshm0 - comment - 16 Mar 2025

@fgsw thank you 👍

avatar hiteshm0
hiteshm0 - comment - 16 Mar 2025

can someone explain why a test isn't passing ?

avatar alikon
alikon - comment - 16 Mar 2025

cause PHP code style is failing
image

check yourself https://ci.joomla.org/joomla/joomla-cms/83395/1/7

avatar hiteshm0
hiteshm0 - comment - 16 Mar 2025

@alikon thank you for your feedback , i think ive fixed it now. Are the changes in the code fine for the issue it is trying to solve ? I would really appreciate your feedback.

avatar hiteshm0 hiteshm0 - change - 17 Mar 2025
The description was changed
avatar hiteshm0 hiteshm0 - edited - 17 Mar 2025
avatar hiteshm0 hiteshm0 - change - 17 Mar 2025
The description was changed
avatar hiteshm0 hiteshm0 - edited - 17 Mar 2025
avatar hiteshm0 hiteshm0 - change - 17 Mar 2025
The description was changed
avatar hiteshm0 hiteshm0 - edited - 17 Mar 2025
avatar hiteshm0 hiteshm0 - change - 17 Mar 2025
The description was changed
avatar hiteshm0 hiteshm0 - edited - 17 Mar 2025
avatar hiteshm0 hiteshm0 - edited - 17 Mar 2025
avatar exlemor
exlemor - comment - 17 Mar 2025

Going to perhaps sound stupid but 2 concerns:

  1. That's a long error message - especially when you consider that when you translate it to other language the length can grow by 30%-40%...

  2. I don't (for me) think the message is descriptive enough - why not, a compromise:

from: Could not make the file name safe. The file name contains invalid characters.

(1 invalid character)
to: Could not save the file name safely, due to invalid character(s): $.

(2 invalid characters)
to: Could not save the file name safely, due to invalid character(s): $, &

Also, why not strip out all of the problem characters to make the filename safe?
then the 2nd line of the error message could be displayed jut as an explanation.

avatar hiteshm0
hiteshm0 - comment - 18 Mar 2025

Hey @exlemor ,

Regarding stripping off the characters to make the filename safe :
In my opinion it is better to throw an error instead.
example : if the user wants save the file as banner#1 instead of saving the file as banner1 it is better to throw an error and the user can think of a more convenient name like banner_1.

I agree with the error message being not descriptive enough
do you think "invalid character used. Please use numbers , letters , - , _ ( and whatever else is allowed ) only" is a better alternative as the error message 1 already mentions that the renaming of the file was unsuccessful ??

Thank you for taking your time out to go through this PR and interested in hearing your opinion further.

avatar exlemor
exlemor - comment - 18 Mar 2025

Hello hiteshm0,

I think:

invalid character used. Please use numbers , letters , - , _ ( and whatever else is allowed ) only

vs

Could not save the file name safely, due to invalid character(s): $, &

makes your error message way too long in terms of length... and that's in English.. so if you wanted to go in your direction in terms of meaning:

Please use only numbers, letters and - , _. Invalid character(s) used: $, &.


(I would still specify the incorrect character or characters used to be most easy to understand)

avatar brianteeman
brianteeman - comment - 18 Mar 2025

as already explained we have an existing language string that should be used. pointless to create extra work for translators etc

JLIB_MEDIA_ERROR_WARNFILENAME

avatar joomla-cms-bot joomla-cms-bot - change - 18 Mar 2025
Category Administration Language & Strings Front End Plugins Front End Plugins
avatar hiteshm0
hiteshm0 - comment - 18 Mar 2025

@brianteeman Thank you for your feedback, I've fixed it now. Are there any other issues ?? Would be happy to learn .

avatar hiteshm0
hiteshm0 - comment - 22 Mar 2025

any updates on this ?

avatar fgsw
fgsw - comment - 22 Mar 2025

@hiteshm0

When a pull request has two successfully tests by two users, who are not the author of the pull request, it gets "Ready to Commit" status and label. Then maintainers will review and merge if ok.

And just because something is tested the maintainers may decide, that its a change or feature that they dont want to accept.

avatar hiteshm0
hiteshm0 - comment - 22 Mar 2025

@fgsw thank you for the information , i appreciate it a lot 👍

avatar hiteshm0 hiteshm0 - change - 22 Mar 2025
Title
[5.2] fix where an error failing to explain the correct reason for failure to rename a file is being thrown.
[5.2] Bug fix : incorrect error thrown while renaming file
avatar hiteshm0 hiteshm0 - edited - 22 Mar 2025
avatar hiteshm0 hiteshm0 - change - 22 Mar 2025
The description was changed
avatar hiteshm0 hiteshm0 - edited - 22 Mar 2025
avatar hiteshm0
hiteshm0 - comment - 22 Mar 2025

@fgsw can you test this maybe or point out what might be wrong , thank you .

avatar hiteshm0 hiteshm0 - change - 23 Mar 2025
Title
[5.2] Bug fix : incorrect error thrown while renaming file
[5.3] Bug fix : incorrect error thrown while renaming file
avatar hiteshm0 hiteshm0 - edited - 23 Mar 2025
avatar hiteshm0 hiteshm0 - change - 23 Mar 2025
Labels Added: PR-5.3-dev
Removed: Language Change
avatar fgsw
fgsw - comment - 23 Mar 2025

@fgsw can you test this maybe

@hiteshm0 I suggest that the author of issue #45087 testing this first.

avatar joomla-cms-bot joomla-cms-bot - change - 23 Mar 2025
Category Front End Plugins External Library Composer Change Front End Plugins
avatar hiteshm0 hiteshm0 - change - 23 Mar 2025
Labels Added: Composer Dependency Changed
avatar joomla-cms-bot joomla-cms-bot - change - 23 Mar 2025
Category Front End Plugins External Library Composer Change Front End Plugins
avatar hiteshm0 hiteshm0 - change - 23 Mar 2025
Labels Removed: Composer Dependency Changed
avatar hiteshm0
hiteshm0 - comment - 26 Mar 2025

Can someone please review and test this, Thank you 👍 .

avatar HLeithner HLeithner - change - 15 Apr 2025
Title
[5.3] Bug fix : incorrect error thrown while renaming file
[5.3] Bug fix : incorrect error thrown while renaming file
avatar HLeithner HLeithner - edited - 15 Apr 2025

Add a Comment

Login with GitHub to post a comment