No Code Attached Yet bug
avatar paternax
paternax
7 Mar 2025

Steps to reproduce the issue

  1. Go to Content - Media
  2. Mark one image and use "Rename"
  3. Add to the file name some "$" - characters and press "Save"

Expected result

One error message like error renaming file

Actual result

There are two error messages:
The first one is like expected: Error renaming item
The second one is irritating for the user: move file is not possible as destination already exists

System information (as much as possible)

Joomla 5.2.4
PHP 8.3

Additional comments

avatar paternax paternax - open - 7 Mar 2025
avatar paternax paternax - change - 7 Mar 2025
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 7 Mar 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Mar 2025
avatar Fedik Fedik - change - 7 Mar 2025
Labels Added: bug
avatar Fedik Fedik - labeled - 7 Mar 2025
avatar chiragjethva03
chiragjethva03 - comment - 8 Mar 2025

Hello, @paternax

I appreciate your detailed report on this issue. I tried reproducing the bug on Joomla 5.2.5-dev, but I was unable to encounter the same problem. Renaming an image file with a "$" symbol works correctly without any duplicate error messages.

It’s possible that this issue was specific to Joomla 5.2.4. Are you currently using 5.2.4? If so, I’d recommend updating to 5.2.5-dev and testing again. If the issue still exists in 5.2.5, please let me know—I may have missed something while verifying the bug, and I’d be happy to recheck.

Image

avatar Kashaf1175
Kashaf1175 - comment - 9 Mar 2025

can i work n this issue

avatar brianteeman
brianteeman - comment - 9 Mar 2025

We don't assign issues. Anyone can work on it

avatar Amaan-ali03
Amaan-ali03 - comment - 12 Mar 2025

Is the bug still there in the latest version?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45087.
avatar alikon
alikon - comment - 12 Mar 2025

@Amaan-ali03 check yourself and if still present then please work on a fix

avatar Amaan-ali03
Amaan-ali03 - comment - 12 Mar 2025

@Amaan-ali03 check yourself and if still present then please work on a fix

Sure sir.

avatar Amaan-ali03
Amaan-ali03 - comment - 12 Mar 2025

Yes there is a bug when we add $ to a file name
as I'm fixing it should I just block the invalid filename or show something like invalid filename ...
suggestions would be appreciated.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45087.
avatar paternax
paternax - comment - 13 Mar 2025

For usabliliy it is important that the user understands why something does not work. There should be a message.

avatar STUDYHUB02
STUDYHUB02 - comment - 14 Mar 2025

I was looking into this issue and I’ve noticed inconsistent behavior when using symbols (like $) in filenames.

If the filename only has symbols (e.g. $$$), it throws an error.

If the filename has symbols and letters (e.g. abc$$ or $$abc or a$b or $a$), it automatically strips the symbols and renames the file to abc, showing a success message.

In my opinion there are 3 ways to fix this:

  1. Sanitize the symbols showing the error message why we cant use those symbols.
  2. When any symbols like this are used, trigger the error message instantly.
  3. Allow to use symbols like this.

I'm interested in your thoughts and if there are any potential side effects with either method in our current codebase.

avatar brianteeman
brianteeman - comment - 14 Mar 2025

As you spotted the filename is sanitized by the removal of those characters on save. Obviously if you remove all the characters in the filename you end up trying to save a file with no name and therefore get the error

avatar STUDYHUB02
STUDYHUB02 - comment - 15 Mar 2025

@brianteeman Thank you for reaching out, but i think i was not clear to explain my point of view in solving the issue.

It is obvious we cant save a file without filename, but what if the file name contains a symbol (eg. $ or any other symbol).

The 1st fix which i mentioned (Sanitize the symbols showing the error message why we can't use those symbols) is when the user tries to save a file with characters and symbols (eg. abc$$ or $$abc) in it , in joomla it just cut down the symbols and rename the file with the characters (abc in this case) with a success message without stating the reason why we can't use those symbols. So my fix to this problem was to show the error message why we can't use those symbols to rename the file.

The 2nd fix which i mentioned (When any symbols like this are used, trigger the error message instantly) is when the user tries to save the file with characters and symbols (eg. abc$$ or $$abc) , so my fix to this problem is to show the error message instantly to not make use of such symbols before user click the save button to rename the file (instant error message).

The 3rd fix (Allow to use symbols like this) was just to allow to make use of such symbols to name their file.

I hope i was clear with it. Please reach out back if I misunderstood you. And state the fix with which i can proceed to fix the issue

avatar hiteshm0
hiteshm0 - comment - 15 Mar 2025

@STUDYHUB02 for solution 3 : symbols like '$' can't be allowed to use in usernames due to potential security reasons.
and is it not better to check for '$' and throw an error inside the function move ?

avatar hiteshm0
hiteshm0 - comment - 15 Mar 2025

it is also important to note that this bug is not specific to '$' and is affected by several other characters such as '!' as well

avatar hiteshm0
hiteshm0 - comment - 16 Mar 2025

the above PR :
(i) throws an error whenever an invalid character is used in the filename and the error thrown explains the reason properly ( "File name must only have alphanumeric characters and no spaces." )
(ii) the normalization logic has been removed leading to stricter validation

[ im a beginner, any feedback is appreciated and apologies if im breaking any convention followed in this org ]

avatar krishnaGandhi11
krishnaGandhi11 - comment - 16 Mar 2025

the above PR : (i) throws an error whenever an invalid character is used in the filename and the error thrown explains the reason properly ( "Could not make the file name safe. The file name contains invalid characters." ) (ii) the normalization logic has been removed leading to stricter validation

[ im a beginner, any feedback is appreciated and apologies if im breaking any convention followed in this org ]

Did you test the case when the user renames a file to a name that ends with full-stop " . " ?

avatar hiteshm0
hiteshm0 - comment - 16 Mar 2025

@krishnaGandhi11 no, but if that character (.) gets sanitised ( ie not allowed ) then the mentioned error will be thrown

avatar alikon alikon - change - 23 Mar 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-03-23 06:53:24
Closed_By alikon
avatar alikon alikon - close - 23 Mar 2025

Add a Comment

Login with GitHub to post a comment