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

Delete trailing whitespaces on rename and mkdir #1253

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/src/plugins/access.fs/FsAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$this->filterUserSelectionToHidden($ctx, [$destNode->getLabel()]);
}else if(isSet($httpVars["filename_new"])){
$filename_new = InputFilter::decodeSecureMagic($httpVars["filename_new"]);
$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 @@ -2399,6 +2401,11 @@ public function makeZip (UserSelection $selection, $dest, $basedir, $taskId = nu
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, "Adding ".$header["stored_filename"]." to archive");
}
$search = $header["filename"];
$split = explode("/", $header["stored_filename"]);
foreach ($split as &$value) {
$value = rtrim($value);
}
$header["stored_filename"] = join("/", $split);
if(!empty($zipEncoding)){
$test = iconv($fsEncoding, $zipEncoding, $header["stored_filename"]);
if($test !== false){
Expand Down Expand Up @@ -2545,4 +2552,4 @@ public function makeSharedRepositoryOptions(ContextInterface $ctx, $httpVars)
}


}
}