Skip to content

Commit 8563ab9

Browse files
authored
Merge pull request #10589 from nextcloud/smb-stat-retry
retry smb stat on timeout
2 parents d1daf65 + 24aaa3b commit 8563ab9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • apps/files_external/lib/Lib/Storage

apps/files_external/lib/Lib/Storage/SMB.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use Icewind\SMB\Exception\ForbiddenException;
4242
use Icewind\SMB\Exception\InvalidArgumentException;
4343
use Icewind\SMB\Exception\NotFoundException;
44+
use Icewind\SMB\Exception\TimedOutException;
4445
use Icewind\SMB\IFileInfo;
4546
use Icewind\SMB\Native\NativeServer;
4647
use Icewind\SMB\ServerFactory;
@@ -258,13 +259,19 @@ public function rename($source, $target, $retry = true) {
258259
return $result;
259260
}
260261

261-
public function stat($path) {
262+
public function stat($path, $retry = true) {
262263
try {
263264
$result = $this->formatInfo($this->getFileInfo($path));
264265
} catch (ForbiddenException $e) {
265266
return false;
266267
} catch (NotFoundException $e) {
267268
return false;
269+
} catch (TimedOutException $e) {
270+
if ($retry) {
271+
return $this->stat($path, false);
272+
} else {
273+
throw $e;
274+
}
268275
}
269276
if ($this->remoteIsShare() && $this->isRootDir($path)) {
270277
$result['mtime'] = $this->shareMTime();

0 commit comments

Comments
 (0)