? ? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
30 Oct 2021

Pull Request for Issue #35940.

Summary of Changes

Currently, if an image contain space in filename is selected in a media form field, it won't be rendered properly. The reason is because media manager encode the filename (replace space character with %20), and that file could not be found by php is_file function. This PR attempts to solve it by replacing %20 back to space before is_file check.

Testing Instructions

  1. Follow #35940 , confirm the issue.
  2. Apply patch, confirm that the issue is fixed.
avatar joomdonation joomdonation - open - 30 Oct 2021
avatar joomdonation joomdonation - change - 30 Oct 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Oct 2021
Category Libraries
avatar brianteeman
brianteeman - comment - 30 Oct 2021

why is it even doing an isfilecheck here and not in other places

avatar joomdonation
joomdonation - comment - 30 Oct 2021

@brianteeman I don't look at the code carefully enough to be sure. However, we use same logic to find css and js file, too.

is_file check is needed so that if Joomla could not find .min file (for css and js), it will use none minified files.

avatar brianteeman
brianteeman - comment - 30 Oct 2021

yes but why use it for this image here and not on similar fields. intro and full image both work perfectly with an image with a space in the name that fails in com_contacts.

avatar joomdonation
joomdonation - comment - 30 Oct 2021

Ah, I see. For article, we use different method to rendering image (not use HTMLHelper::_('image') like in com_contact

The issue in com_contact should be sorted by #35780 . However, I will still leave the PR here in case we want to fix issue if someone stills use HTMLHelper::_('image') in their extension.

avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

I usually never put any spacing in image files. For this Issue I did.

a) within article:

<p>change text</p>
<p>change text change - change text.</p>
<p><img src="/mysite/images/test/schau%20mal%20test.jpg" alt="schau mal test" width="525" height="700"></p> 	</div>`
```<div class="com-contact__thumbnail thumbnail">
<img src="/mysite/images/test/schau mal test.jpg" alt="name" itemprop="image">
<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/35948">issues.joomla.org/tracker/joomla-cms/35948</a>.</sub>
avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

sorry, hv problems with the markup :-) continue 1:

b) within contact formular:

<img src="/mysite/images/test/schau mal test.jpg" alt="name" itemprop="image"><hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/35948">issues.joomla.org/tracker/joomla-cms/35948</a>.</sub>
avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

continue 2-summary:

Images are not broken. But I think, it belongs to linux (broken images) and not to windows.

So, tried PR with a) but there is no difference. Still having 20% (article)


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

avatar joomdonation
joomdonation - comment - 30 Oct 2021

@ChristineWk For contact, without this PR, the markup is something like

<img src="/joomla4/" alt="Image With Space" itemprop="image">

So image won't be displayed. After the PR, the mark up will be:

<img src="/joomla4/images/space%20in%20filename.jpg" alt="Image With Space"" itemprop="image">

So without the PR, image is not being displayed. But with pr, it is displayed.

avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

@joomdonation

thank you for your informations.

Without the PR, image is displayed/shown (file with spaces):

screen shot 2021-10-30 at 13 05 42

What shall I do :-)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35948.
avatar joomdonation
joomdonation - comment - 30 Oct 2021

Oh, strange. Without PR, the image is not being displayed for me (I'm using Windows) and issue also reported at #35940 . Maybe it works for Linux, I'm unsure.

avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

To be sure:
Always thought the opposite: on Linux: no (maybe in generell) on Windows yes (OK).
Do you mean server from the hoster or PC?


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

avatar joomdonation
joomdonation - comment - 30 Oct 2021

Do you mean server from the hoster or PC?
It's the server which the site is hosted.

avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

OK, will check :-)

avatar ChristineWk
ChristineWk - comment - 30 Oct 2021
PHP Built On Linux www45.world4you.com 4.18.0-305.10.2.2.lve.el8.x86_64 #1 SMP Wed Jul 28 12:08:46 EDT 2021 x86_64
mysql
5.7.33-log
latin1_swedish_ci
utf8mb4_general_ci
None
Yes
7.4.21
Apache
cgi-fcgi

hope this helps :-)

avatar joomdonation
joomdonation - comment - 30 Oct 2021

@ChristineWk Thanks. Seems a windows issue, then.

avatar ChristineWk
ChristineWk - comment - 30 Oct 2021

@joomdonation

Seems a windows issue, then.

Aha ... So we need windows Tester, hmm.

avatar Abernyte-Git
Abernyte-Git - comment - 31 Oct 2021

Using J4.1.0dev on WAMP running on a Windows 10 box with php8.11 I cannot replicate the issue. The contact thumb displays fine without the PR patch applied.
screen shot 2021-10-31 at 09 08 14


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

avatar brianteeman
brianteeman - comment - 31 Oct 2021

@Abernyte-Git but does it display in the front end?

avatar Abernyte-Git
Abernyte-Git - comment - 31 Oct 2021

Yes it does.
screen shot 2021-10-31 at 09 45 30


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

avatar joomdonation
joomdonation - comment - 31 Oct 2021

Strange. I thought it might relate to PHP version, so I switched to use PHP 8 but it is still not working for me without the patch. I'm unsure why it works for you two but not for me.

avatar rjharishabh
rjharishabh - comment - 1 Nov 2021

Hi, I can replicate issue #35940 if there are spaces in the file name and this PR solves this issue.

With XAMPP and PHP 8.0.6 in Windows 10

Contact

inContact

Before applying PR

before_PR

After applying PR

after_PR

avatar rjharishabh rjharishabh - test_item - 1 Nov 2021 - Tested successfully
avatar rjharishabh
rjharishabh - comment - 1 Nov 2021

I have tested this item successfully on 632aa10


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

avatar khu5h1
khu5h1 - comment - 3 Nov 2021

Hi, I cannot replicate the issue. The image displayed, is working fine without the PR patch applied.

img1

img2

avatar chmst chmst - test_item - 5 Nov 2021 - Tested successfully
avatar chmst
chmst - comment - 5 Nov 2021

I have tested this item successfully on 632aa10


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

avatar chmst chmst - change - 5 Nov 2021
Status Pending Ready to Commit
avatar chmst
chmst - comment - 5 Nov 2021

RTC

@khu5h1 your image has no space in the filename.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35948.
avatar khu5h1
khu5h1 - comment - 9 Nov 2021

Yes, Now I am able to replicate issue #35940 .
Thanks, @chmst.

img 1

img 2

avatar khu5h1 khu5h1 - test_item - 9 Nov 2021 - Tested successfully
avatar khu5h1
khu5h1 - comment - 9 Nov 2021

I have tested this item successfully on 632aa10


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

avatar pritam825 pritam825 - test_item - 13 Nov 2021 - Tested successfully
avatar pritam825
pritam825 - comment - 13 Nov 2021

I have tested this item successfully on 632aa10


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

avatar pritam825
pritam825 - comment - 13 Nov 2021

I have tested this item successfully on 632aa10


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

avatar HLeithner
HLeithner - comment - 13 Nov 2021

I'm not sure if this fix is correct, because %20 means it's urlencoded and a simple %20 to space convert wouldn't cover all other urlencoded charters.

avatar joomdonation
joomdonation - comment - 22 Nov 2021

@HLeithner Just for information, the space to %20 is handled in local adapter plugin https://github.com/joomla/joomla-cms/blob/4.0-dev/plugins/filesystem/local/src/Adapter/LocalAdapter.php#L754 , and that's the reason I only do simple %20 to space convert in this PR.

avatar wilsonge
wilsonge - comment - 28 Nov 2021

The problem in that case is other adapters aren't going to have that encoding which compounds the problem. Somehow we're going to have to push in the non-encoded paths into this function rather than trying to fix it in this function

avatar wilsonge wilsonge - change - 28 Nov 2021
Status Ready to Commit Pending
avatar richard67 richard67 - change - 19 Dec 2021
Status Pending Needs Review
Labels Added: ? ?
avatar richard67
richard67 - comment - 19 Dec 2021

Setting status "Needs Review" in the issue tracker.


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

avatar joomdonation joomdonation - change - 12 Feb 2022
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2022-02-12 12:11:54
Closed_By joomdonation
Labels Added: ?
Removed: ?
avatar joomdonation joomdonation - close - 12 Feb 2022

Add a Comment

Login with GitHub to post a comment