Merge pull request #16038 from nextcloud/backport/15889/stable16
[stable16] handle storage exceptions when trying to set mtime
This commit is contained in:
commit
870a330abb
2 changed files with 9 additions and 1 deletions
|
@ -566,7 +566,12 @@ class View {
|
|||
$hooks[] = 'create';
|
||||
$hooks[] = 'write';
|
||||
}
|
||||
$result = $this->basicOperation('touch', $path, $hooks, $mtime);
|
||||
try {
|
||||
$result = $this->basicOperation('touch', $path, $hooks, $mtime);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['level' => ILogger::INFO, 'message' => 'Error while setting modified time']);
|
||||
$result = false;
|
||||
}
|
||||
if (!$result) {
|
||||
// If create file fails because of permissions on external storage like SMB folders,
|
||||
// check file exists and return false if not.
|
||||
|
|
|
@ -1962,6 +1962,9 @@ class ViewTest extends \Test\TestCase {
|
|||
$operationArgs,
|
||||
$path
|
||||
) {
|
||||
if ($operation === 'touch') {
|
||||
$this->markTestSkipped("touch handles storage exceptions internally");
|
||||
}
|
||||
$view = new View('/' . $this->user . '/files/');
|
||||
|
||||
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
|
||||
|
|
Loading…
Reference in a new issue