mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
return non escaped path from exceptions
This commit is contained in:
parent
0809553d54
commit
82f961896f
3 changed files with 20 additions and 3 deletions
|
|
@ -63,8 +63,15 @@ class NativeState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function testResult($result, $path) {
|
protected function testResult($result, $uri) {
|
||||||
if ($result === false or $result === null) {
|
if ($result === false or $result === null) {
|
||||||
|
// smb://host/share/path
|
||||||
|
if (is_string($uri)) {
|
||||||
|
list(, , , , $path) = explode('/', $uri, 5);
|
||||||
|
$path = '/' . $path;
|
||||||
|
} else {
|
||||||
|
$path = null;
|
||||||
|
}
|
||||||
$this->handleError($path);
|
$this->handleError($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ class Share extends AbstractShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function simpleCommand($command, $path) {
|
protected function simpleCommand($command, $path) {
|
||||||
$path = $this->escapePath($path);
|
$escapedPath = $this->escapePath($path);
|
||||||
$cmd = $command . ' ' . $path;
|
$cmd = $command . ' ' . $escapedPath;
|
||||||
$output = $this->execute($cmd);
|
$output = $this->execute($cmd);
|
||||||
return $this->parseOutput($output, $path);
|
return $this->parseOutput($output, $path);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Icewind\SMB\Test;
|
namespace Icewind\SMB\Test;
|
||||||
|
|
||||||
use Icewind\SMB\Exception\InvalidPathException;
|
use Icewind\SMB\Exception\InvalidPathException;
|
||||||
|
use Icewind\SMB\Exception\NotFoundException;
|
||||||
use Icewind\SMB\FileInfo;
|
use Icewind\SMB\FileInfo;
|
||||||
|
|
||||||
abstract class AbstractShare extends TestCase {
|
abstract class AbstractShare extends TestCase {
|
||||||
|
|
@ -257,6 +258,15 @@ abstract class AbstractShare extends TestCase {
|
||||||
$this->assertCount(0, $this->share->dir($this->root));
|
$this->assertCount(0, $this->share->dir($this->root));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNotFoundExceptionPath() {
|
||||||
|
try {
|
||||||
|
$this->share->mkdir($this->root . '/foo/bar');
|
||||||
|
$this->fail();
|
||||||
|
} catch(NotFoundException $e) {
|
||||||
|
$this->assertEquals($this->root . '/foo/bar', $e->getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Icewind\SMB\Exception\NotFoundException
|
* @expectedException \Icewind\SMB\Exception\NotFoundException
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue