joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

fix joomla/joomla-cms#36669

Open costafrancesco94 opened this issue 3 years ago • 2 comments

Pull Request for Issue #36669 .

Summary of Changes

Remove JPATH_ROOT from absolute file path only if JPATH_ROOT is at beginning of string

Testing Instructions

Every asset loaded with HTMLHelper::_ is affected

Actual result BEFORE applying this Pull Request

If JPATH_ROOT is repeated inside file names, resources are not getting loaded.

Example: JPATH_ROOT = '/joomla' $path = '/joomla/media/system/images/joomla-favicon.svg' Wrong output before: /media/system/images-favicon.svg

Another less unusual example: JPATH_ROOT = '/app/html $path = '/app/html/media/com_something/js/app/html_custom.js' Wrong output before: /media/com_something/js_custom.js

Expected result AFTER applying this Pull Request

If JPATH_ROOT is present 2 times in the $path, it will be removed only if at beginning (where it should be)

Example: JPATH_ROOT = '/joomla' $path = '/joomla/media/system/images/joomla-favicon.svg' Correct output with patch: /media/system/images/joomla-favicon.svg

Another less unusual example: JPATH_ROOT = '/app/html $path = '/app/html/media/com_something/js/app/html_custom.js' Wrong output before: /media/com_something/js/app/html_custom.js

Documentation Changes Required

Problem was not declared anywhere else

Code run as before (JPATH_ROOT is not supposed to be in the middle of the $path if not for casuality)

costafrancesco94 avatar Jan 14 '22 17:01 costafrancesco94

This pull request has automatically rebased to 4.2-dev.

HLeithner avatar Jun 27 '22 13:06 HLeithner

This pull requests has been automatically converted to the PSR-12 coding standard.

joomla-bot avatar Jun 27 '22 21:06 joomla-bot

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

HLeithner avatar May 02 '23 16:05 HLeithner

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

HLeithner avatar Sep 30 '23 22:09 HLeithner