Skip to content

Commit

Permalink
Also check if the source path is valid for rename and copy operations
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Apr 28, 2013
1 parent 084448a commit d38c7a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/filesystemview.php
Expand Up @@ -259,7 +259,9 @@ public function unlink($path){
public function rename($path1,$path2){
$absolutePath1=$this->getAbsolutePath($path1);
$absolutePath2=$this->getAbsolutePath($path2);
if(OC_FileProxy::runPreProxies('rename',$absolutePath1,$absolutePath2) and OC_Filesystem::isValidPath($path2)){
if(OC_FileProxy::runPreProxies('rename',$absolutePath1,$absolutePath2)
and OC_Filesystem::isValidPath($path1)
and OC_Filesystem::isValidPath($path2)){
$path1=$this->getRelativePath($absolutePath1);
$path2=$this->getRelativePath($absolutePath2);
if($path1==null or $path2==null){
Expand Down Expand Up @@ -290,7 +292,9 @@ public function rename($path1,$path2){
public function copy($path1,$path2){
$absolutePath1=$this->getAbsolutePath($path1);
$absolutePath2=$this->getAbsolutePath($path2);
if(OC_FileProxy::runPreProxies('copy',$absolutePath1,$absolutePath2) and OC_Filesystem::isValidPath($path2)){
if(OC_FileProxy::runPreProxies('copy',$absolutePath1,$absolutePath2)
and OC_Filesystem::isValidPath($path1)
and OC_Filesystem::isValidPath($path2)){
$path1=$this->getRelativePath($absolutePath1);
$path2=$this->getRelativePath($absolutePath2);
if($path1==null or $path2==null){
Expand Down

1 comment on commit d38c7a1

@LukasReschke
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! 🍻

Please sign in to comment.