mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Fix for allfinfo and parsStat for non Windows Fileservers
Small update
This commit is contained in:
parent
ef4b128143
commit
286024db74
2 changed files with 11 additions and 0 deletions
|
|
@ -92,6 +92,11 @@ class Parser {
|
||||||
$size = 0;
|
$size = 0;
|
||||||
foreach ($output as $line) {
|
foreach ($output as $line) {
|
||||||
list($name, $value) = explode(':', $line, 2);
|
list($name, $value) = explode(':', $line, 2);
|
||||||
|
// A line = explode statement may not fill all array elements
|
||||||
|
// properly. May happen when accessing non Windows Fileservers
|
||||||
|
$words = explode(':', $line, 2);
|
||||||
|
$name = isset($words[0]) ? $words[0] : '';
|
||||||
|
$value = isset($words[1]) ? $words[1] : '';
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
if ($name === 'write_time') {
|
if ($name === 'write_time') {
|
||||||
$mtime = strtotime($value);
|
$mtime = strtotime($value);
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,12 @@ class Share implements IShare {
|
||||||
public function stat($path) {
|
public function stat($path) {
|
||||||
$escapedPath = $this->escapePath($path);
|
$escapedPath = $this->escapePath($path);
|
||||||
$output = $this->execute('allinfo ' . $escapedPath);
|
$output = $this->execute('allinfo ' . $escapedPath);
|
||||||
|
// Windows and non Windows Fileserver may respond different
|
||||||
|
// to the allinfo command for directories. If the result is a single
|
||||||
|
// line = error line, redo it with a different allinfo parameter
|
||||||
|
if ($escapedPath == '""' && count($output) < 2) {
|
||||||
|
$output = $this->execute('allinfo ' . '"."');
|
||||||
|
}
|
||||||
if (count($output) < 3) {
|
if (count($output) < 3) {
|
||||||
$this->parseOutput($output, $path);
|
$this->parseOutput($output, $path);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue