? Success

User tests: Successful: Unsuccessful:

avatar N6REJ
N6REJ
12 Dec 2017

Pull Request for Issue # .

Summary of Changes

cleaned all paths to ensure platform proper styling with no mixed platform cases.
no extra '/' in path

Testing Instructions

put preceding '/' in file in HTMLHelper:: call like below..
if($customCSS){ HTMLHelper::_('stylesheet', '/custom.css', $HTMLHelperOptions); }

Expected result

'<link'> or <script> is created with proper pathing

Actual result

// between base and filename.
Mixed case of / and \ in path

Documentation Changes Required

none.
This will help insure platform universalness and was the reason for JPath::clean() being created to begin with.

avatar N6REJ N6REJ - open - 12 Dec 2017
avatar N6REJ N6REJ - change - 12 Dec 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Dec 2017
Category Libraries
avatar N6REJ N6REJ - change - 12 Dec 2017
Title
clean path & prevent duplicate /
clean path in HTMLHelper:: & prevent duplicate /
avatar N6REJ N6REJ - edited - 12 Dec 2017
avatar N6REJ N6REJ - change - 12 Dec 2017
Title
clean path & prevent duplicate /
clean path in HTMLHelper:: & prevent duplicate /
avatar N6REJ N6REJ - change - 12 Dec 2017
The description was changed
avatar N6REJ N6REJ - edited - 12 Dec 2017
avatar mbabker
mbabker - comment - 12 Dec 2017

The mixed use of slashes as it relates to filesystem paths isn't an issue, PHP handles it just fine. Changing the return value will be a problem because at that point the path is supposed to be URI friendly, meaning only using / and not mixed use (or even worse, \). So if there's anything to be done here, it's calling JPath::clean($file, '/'); before any other processing happens to ensure that the only URI segment that isn't being built by that method has its slashes standardized.

avatar N6REJ
N6REJ - comment - 13 Dec 2017

@mbabker are you saying each of these should be removed & it be cleaned elsewhere?

// If the file is in the template folder
$path = \JPath::clean(JPATH_THEMES . "/$template/$folder/$file");

lines 398-399 .. I already removed it around the return.

avatar mbabker
mbabker - comment - 13 Dec 2017

The only change I would make, not knowing what is prompting this to begin with or what the real bug being addressed here is, would be to put a $file = \JPath::clean($file, '/'); call here. All of the other segments are being built by our code, there is no need to clean them. Everything else is overkill or will break things (remember PHP on Windows could care less if you put your path in as C:\Web Server\Joomla/administrator/index.php, filesystem functions will work OK, what is more important is if you are using any part of that file path as a URI that the slashes are standardized to / and as a UX thing if displaying the full path to the user I would use OS native separators, in which case I'd run that through JPath::clean() before displaying it).

avatar N6REJ
N6REJ - comment - 13 Dec 2017

@mbabker ok, what prompted this is I was having some issues getting htmlhelper to function properly and once we got it narrowed down I discovered that if it was called with '/filename' instead of 'filename' it would put a double // and mixed separators.
I'll make the change and recommit it.
Thanks for the help and understanding!!

avatar N6REJ N6REJ - change - 13 Dec 2017
Labels Added: ?
avatar viocassel viocassel - test_item - 2 Jul 2019 - Tested successfully
avatar viocassel
viocassel - comment - 2 Jul 2019

I have tested this item successfully on 07cf909


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

avatar N6REJ
N6REJ - comment - 14 Sep 2019

closing since we have an updated pr.

avatar N6REJ N6REJ - change - 14 Sep 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-09-14 04:05:45
Closed_By N6REJ
avatar N6REJ N6REJ - close - 14 Sep 2019

Add a Comment

Login with GitHub to post a comment