Why JFolder::makeSafe removes dot ?
- meloman
- Joomla! Enthusiast
- Posts: 106
- Joined: Sun Oct 22, 2006 1:29 am
- Location: Montréal
- Contact:
Why JFolder::makeSafe removes dot ?
Why JFolder::makeSafe removes dot ? It's a valid character for a folder name. At least on Linux...
My site is hosted in a folder with my domain name like /home/me/mydomain.com/joomla. If I use makeSafe to clean a path name received from my config form, it removes the dot, and the path is not valid.
Is it a bug in JFolder ? I think even on Windows it's a valid character for a folder name.
My site is hosted in a folder with my domain name like /home/me/mydomain.com/joomla. If I use makeSafe to clean a path name received from my config form, it removes the dot, and the path is not valid.
Is it a bug in JFolder ? I think even on Windows it's a valid character for a folder name.
http://aldra.ca :: My latest little projects
- airton
- Joomla! Ace
- Posts: 1368
- Joined: Sun Nov 04, 2007 1:12 am
- Location: Brazil
- Contact:
Re: Why JFolder::makeSafe removes dot ?
Hi,
Try changing /libraries/joomla/filesystem/folder.php lines 564 to 569 from:To:
I created an artifact in the tracker and proposed a patch to correct this. You can check it at http://joomlacode.org/gf/project/joomla ... m_id=16506
Thanks for reporting,
Try changing /libraries/joomla/filesystem/folder.php lines 564 to 569 from:
Code: Select all
function makeSafe($path)
{
$ds = (DS == '\\') ? '\\' . DS : DS;
$regex = array('#[^A-Za-z0-9:\_\-' . $ds . ' ]#');
return preg_replace($regex, '', $path);
}
Code: Select all
function makeSafe($path)
{
$ds = (DS == '\\') ? '\\' . DS : DS;
$regex = array('#[^A-Za-z0-9:\_\-\.' . $ds . ' ]#');
return preg_replace($regex, '', $path);
}
Thanks for reporting,
Airton Torres
Joomla Bug Squad http://groups.google.com/group/joomlabugsquad
Community website - http://community.joomla.org
Unsolicited support PMs will be deleted and the user added to the foes list.
Joomla Bug Squad http://groups.google.com/group/joomlabugsquad
Community website - http://community.joomla.org
Unsolicited support PMs will be deleted and the user added to the foes list.
- meloman
- Joomla! Enthusiast
- Posts: 106
- Joined: Sun Oct 22, 2006 1:29 am
- Location: Montréal
- Contact:
Re: Why JFolder::makeSafe removes dot ?
Thanks, I will try that tonight !
http://aldra.ca :: My latest little projects
- meloman
- Joomla! Enthusiast
- Posts: 106
- Joined: Sun Oct 22, 2006 1:29 am
- Location: Montréal
- Contact:
Re: Why JFolder::makeSafe removes dot ?
I confirm it's working.
But I will wait until it's fixed in the official code before using makeSafe in my extension...
Thanks for your time!
But I will wait until it's fixed in the official code before using makeSafe in my extension...
Thanks for your time!
http://aldra.ca :: My latest little projects
-
- Joomla! Apprentice
- Posts: 20
- Joined: Wed Oct 10, 2007 12:39 pm
Re: Why JFolder::makeSafe removes dot ?
I've got the exact same problem as the topic starter.
When I look at the change log of Joomla! 1.5.17 it says the following:
I use JFolder::makeSafe in a component i'm working on, so patching Joomla! is not an option.
If I look at the bug-tracker:
http://joomlacode.org/gf/project/joomla ... m_id=16506
It looks like there is no final decision made yet about this matter. Is that right?
Cheers,
Robert
edit: sorry for the major bumb
When I look at the change log of Joomla! 1.5.17 it says the following:
But the problem still exists in Joomla! 1.5.17 and 1.5.1824-Apr-2010 Mark Dexter
# Reverted [#16506] JFolder::makeSafe removes dot
I use JFolder::makeSafe in a component i'm working on, so patching Joomla! is not an option.
If I look at the bug-tracker:
http://joomlacode.org/gf/project/joomla ... m_id=16506
It looks like there is no final decision made yet about this matter. Is that right?
Cheers,
Robert
edit: sorry for the major bumb
- airton
- Joomla! Ace
- Posts: 1368
- Joined: Sun Nov 04, 2007 1:12 am
- Location: Brazil
- Contact:
Re: Why JFolder::makeSafe removes dot ?
Yes, Robert, that's right.robert101083 wrote:If I look at the bug-tracker:
http://joomlacode.org/gf/project/joomla ... m_id=16506
It looks like there is no final decision made yet about this matter. Is that right?
The matter is under discussion in the JBS and the PLT and no agreement has been reached so far as for how exactly it should work. The proposed patch, besides not producing all the desired results, broke other things in 1.5.16 and was reverted in 1.5.17. We hope to reach an agreement about this soon.
Thanks for your patience.
Airton Torres
Joomla Bug Squad http://groups.google.com/group/joomlabugsquad
Community website - http://community.joomla.org
Unsolicited support PMs will be deleted and the user added to the foes list.
Joomla Bug Squad http://groups.google.com/group/joomlabugsquad
Community website - http://community.joomla.org
Unsolicited support PMs will be deleted and the user added to the foes list.
- meloman
- Joomla! Enthusiast
- Posts: 106
- Joined: Sun Oct 22, 2006 1:29 am
- Location: Montréal
- Contact:
Re: Why JFolder::makeSafe removes dot ?
What does it break? A dot is a valid character in a folder name and should not be removed by the makeSafe function. I don't understand why a bug as simple as that is still not resolved a year later!
http://aldra.ca :: My latest little projects
-
- Joomla! Apprentice
- Posts: 20
- Joined: Wed Oct 10, 2007 12:39 pm
Re: Why JFolder::makeSafe removes dot ?
Thanks Airton.airton wrote:Yes, Robert, that's right.robert101083 wrote:If I look at the bug-tracker:
http://joomlacode.org/gf/project/joomla ... m_id=16506
It looks like there is no final decision made yet about this matter. Is that right?
The matter is under discussion in the JBS and the PLT and no agreement has been reached so far as for how exactly it should work. The proposed patch, besides not producing all the desired results, broke other things in 1.5.16 and was reverted in 1.5.17. We hope to reach an agreement about this soon.
Thanks for your patience.
I've been looking at JPath::clean() as well. Can you maybe explain to me what the difference is between JPath:clean and JFolder::makeSafe()?
Cheers,
Robert
-
- Joomla! Fledgling
- Posts: 1
- Joined: Wed Feb 23, 2011 5:58 pm
Re: Why JFolder::makeSafe removes dot ?
bumping this as JFolder is still removing the dot and is breaking perfectly valid installations
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sun Sep 25, 2011 9:54 pm
Re: Why JFolder::makeSafe removes dot ?
Does anyone know how to fix this in Joomla 1.7? I've tried following the instructions but the code is different in 1.7.
I'm not a programmer so I have no idea what to delete/modify!
This is how it looks in 1.7
Any help would be much appreciated!
I'm not a programmer so I have no idea what to delete/modify!
This is how it looks in 1.7
Basically I'm getting an error with an extension because it's removing the . from my domain and the path ends up as /mydomaincom/public static function makeSafe($path)
{
//$ds = (DS == '\\') ? '\\/' : DS;
$regex = array('#[^A-Za-z0-9:_\\\/-]#');
return preg_replace($regex, '', $path);
}
Any help would be much appreciated!
-
- Joomla! Fledgling
- Posts: 3
- Joined: Fri Dec 02, 2011 3:18 am
Re: Why JFolder::makeSafe removes dot ?
is ther any solution yet ?
i have the same problem here on my joomla 1.7
can someone answer another solution,,??
I really need to..really appreciate your reply
thanks
i have the same problem here on my joomla 1.7
can someone answer another solution,,??
I really need to..really appreciate your reply
thanks
- JohnDevise
- Joomla! Apprentice
- Posts: 41
- Joined: Mon Sep 24, 2012 9:34 am
- Location: USA
- Contact:
Re: Why JFolder::makeSafe removes dot ?
Hi haniar .haniar wrote:is ther any solution yet ?
i have the same problem here on my joomla 1.7
can someone answer another solution,,??
I really need to..really appreciate your reply
thanks
Try this solution with patches . I'm not sure , but maybe it's help you - joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=16506