mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +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) {
|
||||
// smb://host/share/path
|
||||
if (is_string($uri)) {
|
||||
list(, , , , $path) = explode('/', $uri, 5);
|
||||
$path = '/' . $path;
|
||||
} else {
|
||||
$path = null;
|
||||
}
|
||||
$this->handleError($path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ class Share extends AbstractShare {
|
|||
}
|
||||
|
||||
protected function simpleCommand($command, $path) {
|
||||
$path = $this->escapePath($path);
|
||||
$cmd = $command . ' ' . $path;
|
||||
$escapedPath = $this->escapePath($path);
|
||||
$cmd = $command . ' ' . $escapedPath;
|
||||
$output = $this->execute($cmd);
|
||||
return $this->parseOutput($output, $path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
namespace Icewind\SMB\Test;
|
||||
|
||||
use Icewind\SMB\Exception\InvalidPathException;
|
||||
use Icewind\SMB\Exception\NotFoundException;
|
||||
use Icewind\SMB\FileInfo;
|
||||
|
||||
abstract class AbstractShare extends TestCase {
|
||||
|
|
@ -257,6 +258,15 @@ abstract class AbstractShare extends TestCase {
|
|||
$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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue