[fixed] filemanager: delete/rename directory with certain ch

The members of the Dev team will place issues here that they consider to be solved.
Post Reply
dwave
Forum Members
Forum Members
Posts: 39
Joined: Mon Aug 13, 2007 11:15 am
Location: Israel

[fixed] filemanager: delete/rename directory with certain ch

Post by dwave »

Steps to reproduce:

1. create new directory
2. name it <>
3. try to delete/rename

it also works the other way round:

1. create new directory
2. name it &
3. try to delete/rename
JeremyBASS

Re: filemanager: delete/rename directory with certain charac

Post by JeremyBASS »

Hello
Personally I don't think this is an issue, but the question would be that do other language charters ie: Accent Marks and Diacritics, will cause this issue.

Cheers -Jeremy
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: filemanager: delete/rename directory with certain charac

Post by calguy1000 »

Well, technically speaking, if FileManager allows you to create the directory, it should allow you to delete/rename it.

The question is... should it allow you to create directories like this? Technically speaking (again) a directory name like > or < or <> or > are legal (if stupid).

So it's decision time. I think I'll make it so that you can't create stupid directories like this. How I'll do it... not exactly sure yet.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
dwave
Forum Members
Forum Members
Posts: 39
Joined: Mon Aug 13, 2007 11:15 am
Location: Israel

Re: filemanager: delete/rename directory with certain charac

Post by dwave »

FileManager.module.php already contains a function ContainsIllegalChars(). It could be extended and then reused in action.newdir. Example:

actions.newdir

Code: Select all

if ($this->ContainsIllegalChars($params["newdirname"]) || $params["newdirname"][0]==".") {
  $this->Redirect($id, 'defaultadmin',$returnid,array("fmerror"=>"invalidnewdir"));
}

FileManager.module.php

Code: Select all

  function ContainsIllegalChars($filename) {
    
    if (strpos($filename, "'")!==false) return true;
    if (strpos($filename, "\"")!==false) return true;
    if (strpos($filename, "/")!==false) return true;
    if (strpos($filename, "\\")!==false) return true;
    if (strpos($filename, "&")!==false) return true;
    if (strpos($filename, "\$")!==false) return true;
    if (strpos($filename, "+")!==false) return true;
    if (strpos($filename, "<")!==false) return true;
    if (strpos($filename, ">")!==false) return true;
    return false;
  }
Last edited by dwave on Sun Aug 28, 2011 10:32 am, edited 1 time in total.
JeremyBASS

Re: filemanager: delete/rename directory with certain charac

Post by JeremyBASS »

calguy1000 wrote: The question is... should it allow you to create directories like this? Technically speaking (again) a directory name like > or < or <> or > are legal (if stupid).
:D it would be very odd to even want to have them, but +1 for the check -J
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: filemanager: delete/rename directory with certain charac

Post by Rolf »

calguy1000 wrote:I think I'll make it so that you can't create stupid directories like this. How I'll do it... not exactly sure yet.
Fixed. I can't create folder with name <> in latest svn.
Please confirm
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “Closed Issues”