diff --git a/core/src/plugins/access.fs/FsAccessDriver.php b/core/src/plugins/access.fs/FsAccessDriver.php
index b31934392e..189bf2258b 100644
--- a/core/src/plugins/access.fs/FsAccessDriver.php
+++ b/core/src/plugins/access.fs/FsAccessDriver.php
@@ -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);
@@ -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{
@@ -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){
@@ -2545,4 +2552,4 @@ public function makeSharedRepositoryOptions(ContextInterface $ctx, $httpVars)
     }
 
 
-}
\ No newline at end of file
+}