summaryrefslogtreecommitdiffstats
path: root/lib/private/Archive
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-25 22:26:47 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-01-26 13:38:34 +0100
commit9ff51aafc518460e6c45996f09e9fe74e5f8d2e8 (patch)
tree7aa302bf04530f0add196f6bcd6e8636333e6be0 /lib/private/Archive
parentb9bbb894f8b01e000bb5e3a8a82db7bebad3ea00 (diff)
downloadnextcloud-server-9ff51aafc518460e6c45996f09e9fe74e5f8d2e8.tar.gz
nextcloud-server-9ff51aafc518460e6c45996f09e9fe74e5f8d2e8.zip
Use index based string access for substr with length of 1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Archive')
-rw-r--r--lib/private/Archive/TAR.php9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index 2c34125afe6..f37da6fc52d 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -91,9 +91,7 @@ class TAR extends Archive {
*/
public function addFolder($path) {
$tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
- if (substr($path, -1, 1) != '/') {
- $path .= '/';
- }
+ $path = rtrim($path, '/') . '/';
if ($this->fileExists($path)) {
return false;
}
@@ -297,10 +295,7 @@ class TAR extends Archive {
if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
return true;
} else {
- $folderPath = $path;
- if (substr($folderPath, -1, 1) != '/') {
- $folderPath .= '/';
- }
+ $folderPath = rtrim($path, '/') . '/';
$pathLength = strlen($folderPath);
foreach ($files as $file) {
if (strlen($file) > $pathLength and substr($file, 0, $pathLength) == $folderPath) {