Merge pull request #15889 from nextcloud/touch-handle-backend-exceptions
handle storage exceptions when trying to set mtime
This commit is contained in:
commit
1ad95caf24
|
@ -566,7 +566,12 @@ class View {
|
||||||
$hooks[] = 'create';
|
$hooks[] = 'create';
|
||||||
$hooks[] = 'write';
|
$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 (!$result) {
|
||||||
// If create file fails because of permissions on external storage like SMB folders,
|
// If create file fails because of permissions on external storage like SMB folders,
|
||||||
// check file exists and return false if not.
|
// check file exists and return false if not.
|
||||||
|
|
|
@ -1962,6 +1962,9 @@ class ViewTest extends \Test\TestCase {
|
||||||
$operationArgs,
|
$operationArgs,
|
||||||
$path
|
$path
|
||||||
) {
|
) {
|
||||||
|
if ($operation === 'touch') {
|
||||||
|
$this->markTestSkipped("touch handles storage exceptions internally");
|
||||||
|
}
|
||||||
$view = new View('/' . $this->user . '/files/');
|
$view = new View('/' . $this->user . '/files/');
|
||||||
|
|
||||||
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
|
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
|
||||||
|
|
Loading…
Reference in New Issue