Skip to content

Commit 3940790

Browse files
authored
Merge pull request #10591 from nextcloud/smb-stat-retry-13
[13] retry smb stat on timeout
2 parents 389b981 + 0450406 commit 3940790

File tree

1 file changed

+8
-1
lines changed
  • apps/files_external/lib/Lib/Storage

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
use Icewind\SMB\Exception\ForbiddenException;
4141
use Icewind\SMB\Exception\InvalidArgumentException;
4242
use Icewind\SMB\Exception\NotFoundException;
43+
use Icewind\SMB\Exception\TimedOutException;
4344
use Icewind\SMB\IFileInfo;
4445
use Icewind\SMB\NativeServer;
4546
use Icewind\SMB\Server;
@@ -235,13 +236,19 @@ public function rename($source, $target, $retry = true) {
235236
return $result;
236237
}
237238

238-
public function stat($path) {
239+
public function stat($path, $retry = true) {
239240
try {
240241
$result = $this->formatInfo($this->getFileInfo($path));
241242
} catch (ForbiddenException $e) {
242243
return false;
243244
} catch (NotFoundException $e) {
244245
return false;
246+
} catch (TimedOutException $e) {
247+
if ($retry) {
248+
return $this->stat($path, false);
249+
} else {
250+
throw $e;
251+
}
245252
}
246253
if ($this->remoteIsShare() && $this->isRootDir($path)) {
247254
$result['mtime'] = $this->shareMTime();

0 commit comments

Comments
 (0)