In conjunction with mimeTypes, for added security, I have a function that forces acceptedName to not start with dot, and to force an extension that is predefined in an array.
Folders don't have extension, therefore this function will prevent folders from being created or renamed. This is undesirable.
Anybody have ideas?
Thanks.
@donShakespeare OK. I'll make a new configuration option acceptedDirname to control the directory name.
Thanks! 馃憤
Done. @donShakespeare you can use acceptedDirname in volume roots options with nightly build or elFinder >= 2.1.24.
Thanks!
Excellent! Thank you. Makes a world of difference now.
Will this remain as acceptedDirname or acceptedDirName
Will there be corresponding changes in the JS ui to return Invalid folder name instead of Invalid file name?
Will the wonderful Sanitizer Plugin also have this feature?
private function sanitizeFolderName($filename, $opts, $allows = array()) {
$targets = $allows? array_diff($opts['targets'], $allows) : $opts['targets'];
return str_replace($targets, $opts['replace'], $filename);
}
or at atleast
private function sanitizeFileName($filename, $origin, $opts, $allows = array()) {
if($origin != "folder"){
$targets = $allows? array_diff($opts['targets'], $allows) : $opts['targets'];
return str_replace($targets, $opts['replace'], $filename);
}
}
Thanks for the suggestion!
Will this remain as acceptedDirname or acceptedDirName
Yes, It is determined as acceptedDirname.
Will there be corresponding changes in the JS ui to return Invalid folder name instead of Invalid file name?
Yes, I'll implement it.
Will the wonderful Sanitizer Plugin also have this feature?
Yes, I'll add an option pathAllows for to make configurable to characters allowed in path name.
Done it. Thanks!
Works beautifully!
I noticed this code errInvDirame not translating; is that something that will be fixed when the release is made? (Invalid folder name)
```
Unable to rename "myFolder".
errInvDirame
I noticed this code errInvDirame not translating; is that something that will be fixed when the release is made? (Invalid folder name)
Yes, it will be included in 2.1.24. Until then you can try it with the nightly build. When you try, do not forget to clear the browser cache.