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

Commit 7cbf214

Browse files
committed
Delete trailing whitespaces on rename and mkdir
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.
1 parent 78328fc commit 7cbf214

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/plugins/access.fs/FsAccessDriver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
11141114
$this->filterUserSelectionToHidden($ctx, [$destNode->getLabel()]);
11151115
}else if(isSet($httpVars["filename_new"])){
11161116
$filename_new = InputFilter::decodeSecureMagic($httpVars["filename_new"]);
1117+
$filename_new = rtrim($filename_new);
11171118
$this->filterUserSelectionToHidden($ctx, [$filename_new]);
11181119
}
11191120
$renamedNode = $this->rename($originalNode, $destNode, $filename_new);
@@ -1148,6 +1149,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
11481149
$parentDir = PathUtils::forwardSlashDirname($newDirPath);
11491150
$basename = PathUtils::forwardSlashBasename($newDirPath);
11501151
$basename = substr($basename, 0, $max_length);
1152+
$basename = rtrim($basename);
11511153
$this->filterUserSelectionToHidden($ctx, [$basename]);
11521154
$parentNode = $selection->nodeForPath($parentDir);
11531155
try{
@@ -2545,4 +2547,4 @@ public function makeSharedRepositoryOptions(ContextInterface $ctx, $httpVars)
25452547
}
25462548

25472549

2548-
}
2550+
}

0 commit comments

Comments
 (0)