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 0ae4217
Showing 1 changed file with 4 additions and 2 deletions.
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 0ae4217

Please sign in to comment.