Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Delete trailing whitespaces on rename and mkdir
Browse files Browse the repository at this point in the history
Whitespace at end of filename cause errors while accessing those files
and dirs via WebDAV (e.g. Nautilus, Caja, etc). This patch tries to
avoid creation of such nodes.
  • Loading branch information
sespivak committed Oct 18, 2016
1 parent 78328fc commit c2aa1de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Utils/Vars/InputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,4 @@ public static function fromPostedFileName($filesystemElement)
}


}
}
6 changes: 4 additions & 2 deletions core/src/plugins/access.fs/FsAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,8 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$destNode = $selection->nodeForPath($dest);
$this->filterUserSelectionToHidden($ctx, [$destNode->getLabel()]);
}else if(isSet($httpVars["filename_new"])){
$filename_new = InputFilter::decodeSecureMagic($httpVars["filename_new"]);
$filename_new = InputFilter::decodeSecureMagic($httpVars["filename_new"], InputFilter::SANITIZE_FILENAME);
$filename_new = rtrim($filename_new);
$this->filterUserSelectionToHidden($ctx, [$filename_new]);
}
$renamedNode = $this->rename($originalNode, $destNode, $filename_new);
Expand Down Expand Up @@ -1148,6 +1149,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$parentDir = PathUtils::forwardSlashDirname($newDirPath);
$basename = PathUtils::forwardSlashBasename($newDirPath);
$basename = substr($basename, 0, $max_length);
$basename = rtrim($basename);
$this->filterUserSelectionToHidden($ctx, [$basename]);
$parentNode = $selection->nodeForPath($parentDir);
try{
Expand Down Expand Up @@ -2545,4 +2547,4 @@ public function makeSharedRepositoryOptions(ContextInterface $ctx, $httpVars)
}


}
}

0 comments on commit c2aa1de

Please sign in to comment.