Files: also check if the source path is valid when doing a rename or copy operation
This commit is contained in:
parent
2314067e75
commit
3c90625ef1
|
@ -263,7 +263,8 @@ class View {
|
||||||
if (is_resource($data)) { //not having to deal with streams in file_put_contents makes life easier
|
if (is_resource($data)) { //not having to deal with streams in file_put_contents makes life easier
|
||||||
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
|
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
|
||||||
if (\OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data)
|
if (\OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data)
|
||||||
&& Filesystem::isValidPath($path)) {
|
&& Filesystem::isValidPath($path)
|
||||||
|
) {
|
||||||
$path = $this->getRelativePath($absolutePath);
|
$path = $this->getRelativePath($absolutePath);
|
||||||
$exists = $this->file_exists($path);
|
$exists = $this->file_exists($path);
|
||||||
$run = true;
|
$run = true;
|
||||||
|
@ -335,8 +336,11 @@ class View {
|
||||||
$postFix2 = (substr($path2, -1, 1) === '/') ? '/' : '';
|
$postFix2 = (substr($path2, -1, 1) === '/') ? '/' : '';
|
||||||
$absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
|
$absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
|
||||||
$absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
|
$absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
|
||||||
if (\OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2)
|
if (
|
||||||
and Filesystem::isValidPath($path2)) {
|
\OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2)
|
||||||
|
and Filesystem::isValidPath($path2)
|
||||||
|
and Filesystem::isValidPath($path1)
|
||||||
|
) {
|
||||||
$path1 = $this->getRelativePath($absolutePath1);
|
$path1 = $this->getRelativePath($absolutePath1);
|
||||||
$path2 = $this->getRelativePath($absolutePath2);
|
$path2 = $this->getRelativePath($absolutePath2);
|
||||||
|
|
||||||
|
@ -396,7 +400,11 @@ class View {
|
||||||
$postFix2 = (substr($path2, -1, 1) === '/') ? '/' : '';
|
$postFix2 = (substr($path2, -1, 1) === '/') ? '/' : '';
|
||||||
$absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
|
$absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
|
||||||
$absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
|
$absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
|
||||||
if (\OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and Filesystem::isValidPath($path2)) {
|
if (
|
||||||
|
\OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2)
|
||||||
|
and Filesystem::isValidPath($path2)
|
||||||
|
and Filesystem::isValidPath($path1)
|
||||||
|
) {
|
||||||
$path1 = $this->getRelativePath($absolutePath1);
|
$path1 = $this->getRelativePath($absolutePath1);
|
||||||
$path2 = $this->getRelativePath($absolutePath2);
|
$path2 = $this->getRelativePath($absolutePath2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue