Skip to content

Commit 6be497c

Browse files
committed
Also check if the source path is valid for rename and copy operations
1 parent a6c5d2d commit 6be497c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/filesystemview.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,9 @@ public function rename($path1, $path2) {
326326
$postFix2=(substr($path2,-1,1)==='/')?'/':'';
327327
$absolutePath1 = OC_Filesystem::normalizePath($this->getAbsolutePath($path1));
328328
$absolutePath2 = OC_Filesystem::normalizePath($this->getAbsolutePath($path2));
329-
if(OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) {
329+
if(OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2)
330+
and OC_Filesystem::isValidPath($path1)
331+
and OC_Filesystem::isValidPath($path2)) {
330332
$path1 = $this->getRelativePath($absolutePath1);
331333
$path2 = $this->getRelativePath($absolutePath2);
332334

@@ -378,7 +380,9 @@ public function copy($path1, $path2) {
378380
$postFix2=(substr($path2,-1,1)==='/')?'/':'';
379381
$absolutePath1 = OC_Filesystem::normalizePath($this->getAbsolutePath($path1));
380382
$absolutePath2 = OC_Filesystem::normalizePath($this->getAbsolutePath($path2));
381-
if(OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) {
383+
if(OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2)
384+
and OC_Filesystem::isValidPath($path1)
385+
and OC_Filesystem::isValidPath($path2)) {
382386
$path1 = $this->getRelativePath($absolutePath1);
383387
$path2 = $this->getRelativePath($absolutePath2);
384388

0 commit comments

Comments
 (0)