mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
fix dir for non existing folders
This commit is contained in:
parent
69e9082def
commit
c91c970a8a
2 changed files with 12 additions and 2 deletions
|
|
@ -66,7 +66,9 @@ class Share {
|
||||||
*/
|
*/
|
||||||
public function dir($path) {
|
public function dir($path) {
|
||||||
$path = $this->escapePath($path);
|
$path = $this->escapePath($path);
|
||||||
$this->execute('cd ' . $path);
|
$output = $this->execute('cd ' . $path);
|
||||||
|
//check output for errors
|
||||||
|
$this->parseOutput($output);
|
||||||
$output = $this->execute('dir');
|
$output = $this->execute('dir');
|
||||||
$this->execute('cd /');
|
$this->execute('cd /');
|
||||||
|
|
||||||
|
|
@ -199,7 +201,8 @@ class Share {
|
||||||
if (strpos($lines[0], 'does not exist')) {
|
if (strpos($lines[0], 'does not exist')) {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
list($error,) = explode(' ', $lines[0]);
|
$parts = explode(' ', $lines[0]);
|
||||||
|
$error = array_pop($parts);
|
||||||
switch ($error) {
|
switch ($error) {
|
||||||
case ErrorCodes::PathNotFound:
|
case ErrorCodes::PathNotFound:
|
||||||
case ErrorCodes::ObjectNotFound:
|
case ErrorCodes::ObjectNotFound:
|
||||||
|
|
|
||||||
|
|
@ -255,4 +255,11 @@ class Share extends \PHPUnit_Framework_TestCase {
|
||||||
$this->share->rmdir($this->root . '/foobar');
|
$this->share->rmdir($this->root . '/foobar');
|
||||||
$this->share->del($this->root . '/foobar');
|
$this->share->del($this->root . '/foobar');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \SMB\NotFoundException
|
||||||
|
*/
|
||||||
|
public function testDirNonExisting() {
|
||||||
|
$this->share->dir('/foobar/asd');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue