Commit b986ffc6 authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge "Trim directory names before they are made (bug #813905)"

parents de016b04 ff3fd0e4
......@@ -860,7 +860,7 @@ function pieform_element_filebrowser_createfolder(Pieform $form, $element, $data
$data = (object) array(
'parent' => $parentfolder,
'owner' => null,
'title' => $data['title'],
'title' => trim($data['title']),
);
if ($parentfolder) {
......@@ -938,7 +938,7 @@ function pieform_element_filebrowser_update(Pieform $form, $element, $data) {
}
}
$artefact->set('title', $data['title']);
$artefact->set('title', trim($data['title']));
$artefact->set('description', $data['description']);
$artefact->set('allowcomments', (int) $data['allowcomments']);
......
......@@ -305,7 +305,7 @@ class PluginExportHtml extends PluginExport {
* aren't legal on most real filesystems.
*/
public static function sanitise_path($path) {
return substr(str_replace('/', '_', $path), 0, 255);
return trim(substr(str_replace('/', '_', $path), 0, 255));
}
......@@ -522,7 +522,7 @@ abstract class HtmlExportArtefactPlugin {
public function paginate($artefact) {
// Create directory for storing the artefact
$dirname = PluginExportHtml::text_to_path($artefact->get('title'));
$dirname = PluginExportHtml::text_to_path(trim($artefact->get('title')));
if (!check_dir_exists($this->fileroot . $dirname)) {
throw new SystemException("Couldn't create artefact directory {$this->fileroot}{$dirname}");
}
......
......@@ -776,6 +776,7 @@ function rmdirr($dirname)
*/
function copyr($source, $dest)
{
$dest = trim($dest);
// Check for symlinks
if (is_link($source)) {
return symlink(readlink($source), $dest);
......
......@@ -1090,6 +1090,7 @@ function is_hash($array) {
function check_dir_exists($dir, $create=true, $recursive=true) {
$status = true;
$dir = trim($dir);
if(!is_dir($dir)) {
if (!$create) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment